Moved manual cleanup to setup

This commit is contained in:
M66B 2019-05-01 22:01:58 +02:00
parent ff34a1ec64
commit edfe608730
2 changed files with 21 additions and 21 deletions

View File

@ -246,6 +246,12 @@ public class ActivitySetup extends ActivityBilling implements FragmentManager.On
drawerLayout.closeDrawer(drawerContainer);
onMenuPrivacy();
}
}, new Runnable() {
@Override
public void run() {
drawerLayout.closeDrawer(drawerContainer);
onCleanup();
}
}));
menus.add(new NavMenuItem(R.drawable.baseline_info_24, R.string.menu_about, new Runnable() {
@ -516,6 +522,21 @@ public class ActivitySetup extends ActivityBilling implements FragmentManager.On
Helper.view(this, this, Helper.getIntentPrivacy());
}
private void onCleanup() {
new SimpleTask<Void>() {
@Override
protected Void onExecute(Context context, Bundle args) {
WorkerCleanup.cleanup(context, true);
return null;
}
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(ActivitySetup.this, ActivitySetup.this, ex);
}
}.execute(this, new Bundle(), "cleanup:run");
}
private void onMenuAbout() {
if (getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.RESUMED))
getSupportFragmentManager().popBackStack("about", FragmentManager.POP_BACK_STACK_INCLUSIVE);

View File

@ -309,12 +309,6 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
drawerLayout.closeDrawer(drawerContainer);
onMenuPrivacy();
}
}, new Runnable() {
@Override
public void run() {
drawerLayout.closeDrawer(drawerContainer);
onCleanup();
}
}));
extra.add(new NavMenuItem(R.drawable.baseline_info_24, R.string.menu_about, new Runnable() {
@ -1025,21 +1019,6 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
}.execute(this, new Bundle(), "debug:info");
}
private void onCleanup() {
new SimpleTask<Void>() {
@Override
protected Void onExecute(Context context, Bundle args) {
WorkerCleanup.cleanup(ActivityView.this, true);
return null;
}
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(ActivityView.this, ActivityView.this, ex);
}
}.execute(this, new Bundle(), "cleanup:job");
}
private void onShowLog() {
if (getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.RESUMED))
getSupportFragmentManager().popBackStack("logs", FragmentManager.POP_BACK_STACK_INCLUSIVE);