1
0
Fork 0
mirror of https://github.com/M66B/NetGuard.git synced 2024-12-30 20:05:04 +00:00

Merge branch 'master' of github.com:M66B/NetGuard

This commit is contained in:
M66B 2015-12-09 19:42:36 +01:00
commit f36f7fc130

View file

@ -255,7 +255,7 @@ public class SinkholeService extends VpnService {
private void startStats() {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(SinkholeService.this);
boolean enabled = prefs.getBoolean("show_stats", false);
boolean enabled = (!stats && prefs.getBoolean("show_stats", false));
Log.i(TAG, "Stats start enabled=" + enabled);
if (enabled) {
t = -1;
@ -272,14 +272,13 @@ public class SinkholeService extends VpnService {
private void stopStats() {
Log.i(TAG, "Stats stop");
stats = false;
mServiceHandler.removeMessages(MSG_STATS_START);
mServiceHandler.removeMessages(MSG_STATS_STOP);
mServiceHandler.removeMessages(MSG_STATS_UPDATE);
NotificationManagerCompat.from(SinkholeService.this).cancel(NOTIFY_TRAFFIC);
}
private void updateStats() {
if (!stats)
return;
// Schedule next update
mServiceHandler.sendEmptyMessageDelayed(MSG_STATS_UPDATE, 1000);