Added reset

This commit is contained in:
M66B 2019-04-06 14:52:35 +02:00
parent 8cf35e8499
commit 670079f6e2
2 changed files with 14 additions and 3 deletions

View File

@ -253,7 +253,7 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
onShowLog();
break;
case R.string.menu_setup:
onReload();
onReset();
break;
case R.string.menu_faq:
onDebugInfo();
@ -1068,8 +1068,8 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
Helper.view(this, this, getIntentOtherApps());
}
private void onReload() {
ServiceSynchronize.reload(this, "manual reload");
private void onReset() {
ServiceSynchronize.reset(this);
}
private void onDebugInfo() {

View File

@ -204,6 +204,11 @@ public class ServiceSynchronize extends LifecycleService {
onReload(intent.getStringExtra("reason"));
break;
case "reset":
lastLost = 0;
onReload("reset");
break;
case "oneshot_start":
onOneshot(true);
break;
@ -1277,6 +1282,12 @@ public class ServiceSynchronize extends LifecycleService {
.putExtra("reason", reason));
}
static void reset(Context context) {
ContextCompat.startForegroundService(context,
new Intent(context, ServiceSynchronize.class)
.setAction("reset"));
}
static void process(Context context) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
boolean enabled = prefs.getBoolean("enabled", true);