mirror of
https://github.com/M66B/NetGuard.git
synced 2025-02-26 08:02:47 +00:00
Disable live traffic updates on pause
This commit is contained in:
parent
064f4922fe
commit
7c974c7278
1 changed files with 17 additions and 3 deletions
|
@ -147,13 +147,27 @@ public class ActivityLog extends AppCompatActivity {
|
|||
});
|
||||
|
||||
live = true;
|
||||
DatabaseHelper.addLogChangedListener(listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
if (live) {
|
||||
DatabaseHelper.addLogChangedListener(listener);
|
||||
adapter = new LogAdapter(ActivityLog.this, dh.getLog());
|
||||
lvLog.setAdapter(adapter);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
if (live)
|
||||
DatabaseHelper.removeLocationChangedListener(listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
if (live)
|
||||
DatabaseHelper.removeLocationChangedListener(listener);
|
||||
dh.close();
|
||||
super.onDestroy();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue