fix #430
This commit is contained in:
@@ -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 = {
|
||||
|
||||
Reference in New Issue
Block a user