refine the traffic stat

This commit is contained in:
Max Lv
2015-11-18 14:53:56 +08:00
parent e667a77b71
commit 07b9cfa7f1
2 changed files with 7 additions and 3 deletions
@@ -471,7 +471,11 @@ class Shadowsocks
// initialize timer
val task = new TimerTask {
def run() {
TrafficMonitor.update()
if (state == State.CONNECTED) {
TrafficMonitor.update()
} else {
TrafficMonitor.reset()
}
val pm = getSystemService(Context.POWER_SERVICE).asInstanceOf[PowerManager]
if (pm.isScreenOn) {
val trafficStat = getString(R.string.stat_summary).formatLocal(Locale.ENGLISH,