Commit 811ad74a authored by Max Lv's avatar Max Lv

fix #430

parent 07b9cfa7
...@@ -18,11 +18,13 @@ ...@@ -18,11 +18,13 @@
<item name="colorAccent">@color/material_accent_500</item> <item name="colorAccent">@color/material_accent_500</item>
<item name="colorPrimary">@color/material_accent_500</item> <item name="colorPrimary">@color/material_accent_500</item>
<item name="colorPrimaryDark">@color/material_accent_700</item> <item name="colorPrimaryDark">@color/material_accent_700</item>
<item name="android:windowBackground">@android:color/transparent</item>
</style> </style>
<style name="Theme.Material.Dialog.Alert" parent="Theme.AppCompat.Light.Dialog.Alert"> <style name="Theme.Material.Dialog.Alert" parent="Theme.AppCompat.Light.Dialog.Alert">
<item name="colorAccent">@color/material_accent_500</item> <item name="colorAccent">@color/material_accent_500</item>
<item name="colorPrimary">@color/material_accent_500</item> <item name="colorPrimary">@color/material_accent_500</item>
<item name="colorPrimaryDark">@color/material_accent_700</item> <item name="colorPrimaryDark">@color/material_accent_700</item>
<item name="android:windowBackground">@android:color/transparent</item>
</style> </style>
<style name="PopupTheme" parent="Theme.Material.Dialog"> <style name="PopupTheme" parent="Theme.Material.Dialog">
...@@ -35,6 +37,7 @@ ...@@ -35,6 +37,7 @@
<item name="android:windowActionModeOverlay">true</item> <item name="android:windowActionModeOverlay">true</item>
<item name="android:colorBackgroundCacheHint">@null</item> <item name="android:colorBackgroundCacheHint">@null</item>
<item name="android:windowIsTranslucent">true</item> <item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">@android:color/transparent</item>
</style> </style>
</resources> </resources>
...@@ -2,7 +2,7 @@ package com.github.shadowsocks.utils ...@@ -2,7 +2,7 @@ package com.github.shadowsocks.utils
import android.net.TrafficStats import android.net.TrafficStats
import android.os.Process import android.os.Process
import java.lang.{String, System} import java.lang.{String, System, Math}
import java.util.Locale import java.util.Locale
case class Traffic(tx: Long, rx: Long, timestamp: Long) case class Traffic(tx: Long, rx: Long, timestamp: Long)
...@@ -20,8 +20,8 @@ object TrafficMonitor { ...@@ -20,8 +20,8 @@ object TrafficMonitor {
var rxTotal: Long = 0 var rxTotal: Long = 0
def getTraffic(): Traffic = { def getTraffic(): Traffic = {
new Traffic(TrafficStats.getTotalTxBytes - TrafficStats.getUidTxBytes(uid), new Traffic(Math.max(TrafficStats.getTotalTxBytes - TrafficStats.getUidTxBytes(uid), 0),
TrafficStats.getTotalRxBytes - TrafficStats.getUidRxBytes(uid), System.currentTimeMillis()) Math.max(TrafficStats.getTotalRxBytes - TrafficStats.getUidRxBytes(uid), 0), System.currentTimeMillis())
} }
def formatTraffic(n: Long): String = { def formatTraffic(n: Long): String = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment