Traffic accounting units

This commit is contained in:
M66B 2016-02-15 18:31:08 +01:00
parent b4810bcd61
commit 53b6b99764
2 changed files with 14 additions and 3 deletions

View File

@ -158,8 +158,17 @@ public class AdapterAccess extends CursorAdapter {
tvDest.setTextColor(colorOff);
tvTraffic.setVisibility(sent > 0 || received > 0 ? View.VISIBLE : View.GONE);
tvTraffic.setText(context.getString(R.string.msg_kb,
(sent > 0 ? sent / 1024f : 0),
(received > 0 ? received / 1024f : 0)));
if (sent > 1024 * 1204 * 1024L || received > 1024 * 1024 * 1024L)
tvTraffic.setText(context.getString(R.string.msg_gb,
(sent > 0 ? sent / (1024 * 1024 * 1024f) : 0),
(received > 0 ? received / (1024 * 1024 * 1024f) : 0)));
else if (sent > 1204 * 1024L || received > 1024 * 1024L)
tvTraffic.setText(context.getString(R.string.msg_mb,
(sent > 0 ? sent / (1024 * 1024f) : 0),
(received > 0 ? received / (1024 * 1024f) : 0)));
else
tvTraffic.setText(context.getString(R.string.msg_kb,
(sent > 0 ? sent / 1024f : 0),
(received > 0 ? received / 1024f : 0)));
}
}

View File

@ -149,6 +149,8 @@ Your internet traffic is not being sent to a remote VPN server.</string>
<string name="msg_kbsec">%7.3f KB/s</string>
<string name="msg_mbsec">%7.3f MB/s</string>
<string name="msg_kb">%1$.3f&#9650; %2$.3f&#9660; KB</string>
<string name="msg_mb">%1$.3f&#9650; %2$.3f&#9660; MB</string>
<string name="msg_gb">%1$.3f&#9650; %2$.3f&#9660; GB</string>
<string name="msg_filter">Using filtering will cause Android to attribute data and power usage to NetGuard - Android assumes the data and power are being used by NetGuard, rather than the original applications</string>
<string name="msg_log_disabled">Traffic logging is disabled, use the switch above to enable logging. Traffic logging might result in extra battery usage.</string>
<string name="msg_clear_rules">This will reset the rules and conditions to their default values</string>