Improve static data management

This commit is contained in:
topjohnwu
2017-01-30 20:04:49 +08:00
parent bfec381933
commit b9495cd1bb
4 changed files with 25 additions and 30 deletions

View File

@@ -87,9 +87,8 @@ public class MainActivity extends AppCompatActivity
protected void onResume() {
super.onResume();
CallbackHandler.register(Global.Events.updateCheckDone, this);
if (Global.Events.updateCheckDone.isTriggered) {
if (Global.Events.updateCheckDone.isTriggered)
onTrigger(Global.Events.updateCheckDone);
}
checkHideSection();
}
@@ -102,16 +101,17 @@ public class MainActivity extends AppCompatActivity
@Override
protected void onDestroy() {
CallbackHandler.unRegister(Global.Events.reloadMainActivity, this);
// Let garbage collector remove them
Global.Data.clear();
super.onDestroy();
}
@Override
public void onBackPressed() {
if (drawer.isDrawerOpen(navigationView)) {
if (drawer.isDrawerOpen(navigationView))
drawer.closeDrawer(navigationView);
} else {
else
finish();
}
}
@Override