This commit is contained in:
Max Lv
2015-11-18 20:29:19 +08:00
parent 07b9cfa7f1
commit 811ad74acb
2 changed files with 6 additions and 3 deletions
+3
View File
@@ -18,11 +18,13 @@
<item name="colorAccent">@color/material_accent_500</item>
<item name="colorPrimary">@color/material_accent_500</item>
<item name="colorPrimaryDark">@color/material_accent_700</item>
<item name="android:windowBackground">@android:color/transparent</item>
</style>
<style name="Theme.Material.Dialog.Alert" parent="Theme.AppCompat.Light.Dialog.Alert">
<item name="colorAccent">@color/material_accent_500</item>
<item name="colorPrimary">@color/material_accent_500</item>
<item name="colorPrimaryDark">@color/material_accent_700</item>
<item name="android:windowBackground">@android:color/transparent</item>
</style>
<style name="PopupTheme" parent="Theme.Material.Dialog">
@@ -35,6 +37,7 @@
<item name="android:windowActionModeOverlay">true</item>
<item name="android:colorBackgroundCacheHint">@null</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">@android:color/transparent</item>
</style>
</resources>
@@ -2,7 +2,7 @@ package com.github.shadowsocks.utils
import android.net.TrafficStats
import android.os.Process
import java.lang.{String, System}
import java.lang.{String, System, Math}
import java.util.Locale
case class Traffic(tx: Long, rx: Long, timestamp: Long)
@@ -20,8 +20,8 @@ object TrafficMonitor {
var rxTotal: Long = 0
def getTraffic(): Traffic = {
new Traffic(TrafficStats.getTotalTxBytes - TrafficStats.getUidTxBytes(uid),
TrafficStats.getTotalRxBytes - TrafficStats.getUidRxBytes(uid), System.currentTimeMillis())
new Traffic(Math.max(TrafficStats.getTotalTxBytes - TrafficStats.getUidTxBytes(uid), 0),
Math.max(TrafficStats.getTotalRxBytes - TrafficStats.getUidRxBytes(uid), 0), System.currentTimeMillis())
}
def formatTraffic(n: Long): String = {