diff --git a/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java b/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java index 004b14f184..a4a0ecd8b7 100644 --- a/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java +++ b/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java @@ -73,7 +73,6 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc private TextView tvFtsPro; private SwitchCompat swEnglish; private SwitchCompat swWatchdog; - private SwitchCompat swOptimize; private SwitchCompat swUpdates; private SwitchCompat swExperiments; private TextView tvExperimentsHint; @@ -98,7 +97,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc private Group grpDebug; private final static String[] RESET_OPTIONS = new String[]{ - "shortcuts", "fts", "english", "watchdog", "auto_optimize", "updates", + "shortcuts", "fts", "english", "watchdog", "updates", "experiments", "crash_reports", "debug", "auth_sasl", "cleanup_attachments" }; @@ -129,7 +128,6 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc tvFtsPro = view.findViewById(R.id.tvFtsPro); swEnglish = view.findViewById(R.id.swEnglish); swWatchdog = view.findViewById(R.id.swWatchdog); - swOptimize = view.findViewById(R.id.swOptimize); swUpdates = view.findViewById(R.id.swUpdates); swExperiments = view.findViewById(R.id.swExperiments); tvExperimentsHint = view.findViewById(R.id.tvExperimentsHint); @@ -235,14 +233,6 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc } }); - swOptimize.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { - @Override - public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { - prefs.edit().putBoolean("auto_optimize", checked).apply(); - ServiceSynchronize.reload(getContext(), null, false, "optimize"); - } - }); - swUpdates.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { @@ -542,7 +532,6 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc swFts.setChecked(prefs.getBoolean("fts", false)); swEnglish.setChecked(prefs.getBoolean("english", false)); swWatchdog.setChecked(prefs.getBoolean("watchdog", true)); - swOptimize.setChecked(prefs.getBoolean("auto_optimize", false)); swUpdates.setChecked(prefs.getBoolean("updates", true)); swUpdates.setVisibility( Helper.isPlayStoreInstall() || !Helper.hasValidFingerprint(getContext()) diff --git a/app/src/main/java/eu/faircode/email/FragmentOptionsSynchronize.java b/app/src/main/java/eu/faircode/email/FragmentOptionsSynchronize.java index e0c452fdb1..f19638457c 100644 --- a/app/src/main/java/eu/faircode/email/FragmentOptionsSynchronize.java +++ b/app/src/main/java/eu/faircode/email/FragmentOptionsSynchronize.java @@ -62,6 +62,7 @@ import java.util.Objects; public class FragmentOptionsSynchronize extends FragmentBase implements SharedPreferences.OnSharedPreferenceChangeListener { private SwitchCompat swEnabled; private Spinner spPollInterval; + private SwitchCompat swOptimize; private RecyclerView rvExempted; private SwitchCompat swSchedule; private TextView tvSchedulePro; @@ -86,7 +87,7 @@ public class FragmentOptionsSynchronize extends FragmentBase implements SharedPr private AdapterAccountExempted adapter; private final static String[] RESET_OPTIONS = new String[]{ - "enabled", "poll_interval", "schedule", "schedule_start", "schedule_end", + "enabled", "poll_interval", "auto_optimize", "schedule", "schedule_start", "schedule_end", "sync_nodate", "sync_unseen", "sync_flagged", "delete_unseen", "sync_kept", "gmail_thread_id", "sync_folders", "sync_shared_folders", "subscriptions", "check_mx", "check_reply", "tune_keep_alive" @@ -104,6 +105,7 @@ public class FragmentOptionsSynchronize extends FragmentBase implements SharedPr swEnabled = view.findViewById(R.id.swEnabled); spPollInterval = view.findViewById(R.id.spPollInterval); + swOptimize = view.findViewById(R.id.swOptimize); swSchedule = view.findViewById(R.id.swSchedule); rvExempted = view.findViewById(R.id.rvExempted); tvSchedulePro = view.findViewById(R.id.tvSchedulePro); @@ -171,6 +173,14 @@ public class FragmentOptionsSynchronize extends FragmentBase implements SharedPr } }); + swOptimize.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { + prefs.edit().putBoolean("auto_optimize", checked).apply(); + ServiceSynchronize.reload(getContext(), null, false, "optimize"); + } + }); + rvExempted.setHasFixedSize(false); LinearLayoutManager llm = new LinearLayoutManager(getContext()); rvExempted.setLayoutManager(llm); @@ -384,6 +394,8 @@ public class FragmentOptionsSynchronize extends FragmentBase implements SharedPr spPollInterval.setSelection(pos); break; } + + swOptimize.setChecked(prefs.getBoolean("auto_optimize", false)); grpExempted.setVisibility(pollInterval == 0 ? View.GONE : View.VISIBLE); swSchedule.setChecked(prefs.getBoolean("schedule", false) && pro); diff --git a/app/src/main/res/layout/fragment_options_misc.xml b/app/src/main/res/layout/fragment_options_misc.xml index 76a7869d17..1406de8666 100644 --- a/app/src/main/res/layout/fragment_options_misc.xml +++ b/app/src/main/res/layout/fragment_options_misc.xml @@ -146,30 +146,6 @@ app:layout_constraintTop_toBottomOf="@id/tvEnglishHint" app:switchPadding="12dp" /> - - - - - + app:layout_constraintTop_toBottomOf="@id/tvPollHint" + app:switchPadding="12dp" /> + app:layout_constraintTop_toBottomOf="@id/swOptimize" /> Use US country settings Periodically check if FairEmail is still active SASL - Automatically optimize settings + Automatically optimize Check for updates Try experimental features Send error reports @@ -479,7 +479,6 @@ Globally disable or enable receiving of messages If synchronization is disabled, it is still possible to synchronize manually by pulling down the message list. Synchronizing periodically will compare local and remote messages each and every time, which is an expensive operation possibly resulting in extra battery usage, especially when there are a lot of messages to synchronize. Always synchronizing will avoid this by continuous monitoring for changes only. - This option can be optimized automatically (miscellaneous settings) Tap on a time to set a time Some providers store messages with an unknown, invalid or future date as messages without date Some providers don\'t support this properly, which may cause synchronizing none or all messages @@ -541,7 +540,6 @@ Enabling this improves search performance, but also increases battery and storage space usage This will restart the app - Enabling this can automatically change the receive settings to reduce battery usage List of current experimental features Enable extra logging and show debug information at various places When manually cleaning, this will remove attachments from messages that are no longer synchronized