diff --git a/app/src/main/java/eu/faircode/email/FragmentOptionsSynchronize.java b/app/src/main/java/eu/faircode/email/FragmentOptionsSynchronize.java index e38af5e1a7..e98871e4dc 100644 --- a/app/src/main/java/eu/faircode/email/FragmentOptionsSynchronize.java +++ b/app/src/main/java/eu/faircode/email/FragmentOptionsSynchronize.java @@ -235,6 +235,8 @@ public class FragmentOptionsSynchronize extends FragmentBase implements SharedPr if (value != current) { adapterView.setTag(value); prefs.edit().putInt("poll_interval", value).apply(); + if (value == 0) + prefs.edit().remove("auto_optimize").apply(); tvPollBattery.setVisibility(value > 0 && value < 15 ? View.VISIBLE : View.GONE); grpExempted.setVisibility(value == 0 ? View.GONE : View.VISIBLE); } diff --git a/app/src/main/java/eu/faircode/email/FragmentSetup.java b/app/src/main/java/eu/faircode/email/FragmentSetup.java index 18ae917e8f..d7f010cee8 100644 --- a/app/src/main/java/eu/faircode/email/FragmentSetup.java +++ b/app/src/main/java/eu/faircode/email/FragmentSetup.java @@ -600,7 +600,10 @@ public class FragmentSetup extends FragmentBase implements SharedPreferences.OnS cbAlways.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton v, boolean isChecked) { - prefs.edit().putInt("poll_interval", isChecked ? 0 : EntityAccount.DEFAULT_POLL_INTERVAL).apply(); + int value = (isChecked ? 0 : EntityAccount.DEFAULT_POLL_INTERVAL); + prefs.edit().putInt("poll_interval", value).apply(); + if (value == 0) + prefs.edit().remove("auto_optimize").apply(); } });