From 53b6b997645fcd8cee261f819d2b7353d7a09f10 Mon Sep 17 00:00:00 2001 From: M66B Date: Mon, 15 Feb 2016 18:31:08 +0100 Subject: [PATCH] Traffic accounting units --- .../java/eu/faircode/netguard/AdapterAccess.java | 15 ++++++++++++--- app/src/main/res/values/strings.xml | 2 ++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/eu/faircode/netguard/AdapterAccess.java b/app/src/main/java/eu/faircode/netguard/AdapterAccess.java index b73c478d..4194f663 100644 --- a/app/src/main/java/eu/faircode/netguard/AdapterAccess.java +++ b/app/src/main/java/eu/faircode/netguard/AdapterAccess.java @@ -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))); } } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 75305652..9b787998 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -149,6 +149,8 @@ Your internet traffic is not being sent to a remote VPN server. %7.3f KB/s %7.3f MB/s %1$.3f▲ %2$.3f▼ KB + %1$.3f▲ %2$.3f▼ MB + %1$.3f▲ %2$.3f▼ GB 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 Traffic logging is disabled, use the switch above to enable logging. Traffic logging might result in extra battery usage. This will reset the rules and conditions to their default values