From 49d8a0167b8235e7d5b6fa57b3e2dbb32340e108 Mon Sep 17 00:00:00 2001 From: M66B Date: Sun, 17 Apr 2022 13:52:54 +0200 Subject: [PATCH] Moved watchdog to advanced --- .../faircode/email/FragmentOptionsMisc.java | 25 ++++++++-------- .../main/res/layout/fragment_options_misc.xml | 30 ++++++++++--------- 2 files changed, 29 insertions(+), 26 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java b/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java index fc798d34a6..9d98f52bfc 100644 --- a/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java +++ b/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java @@ -112,7 +112,6 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc private SwitchCompat swDeepL; private ImageButton ibDeepL; private TextView tvSdcard; - private SwitchCompat swWatchdog; private SwitchCompat swUpdates; private ImageButton ibChannelUpdated; private SwitchCompat swCheckWeekly; @@ -125,6 +124,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc private TextView tvLastCleanup; private CardView cardAdvanced; + private SwitchCompat swWatchdog; private SwitchCompat swExperiments; private TextView tvExperimentsHint; private SwitchCompat swProtocol; @@ -204,10 +204,11 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc private final static String[] RESET_OPTIONS = new String[]{ "sort_answers", "shortcuts", "fts", "classification", "class_min_probability", "class_min_difference", - "language", "deepl_enabled", "watchdog", + "language", "deepl_enabled", "updates", "weekly", "show_changelog", "crash_reports", "cleanup_attachments", - "experiments", "protocol", "log_level", "debug", "leak_canary", "test1", "test2", "test3", "test4", "test5", + "watchdog", "experiments", "protocol", "log_level", "debug", "leak_canary", "test1", + "test2", "test3", "test4", "test5", "work_manager", // "external_storage", "query_threads", "wal", "sqlite_checkpoints", "sqlite_analyze", "sqlite_cache", "chunk_size", "thread_range", "undo_manager", "webview_legacy", "browser_zoom", @@ -281,7 +282,6 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc swDeepL = view.findViewById(R.id.swDeepL); ibDeepL = view.findViewById(R.id.ibDeepL); tvSdcard = view.findViewById(R.id.tvSdcard); - swWatchdog = view.findViewById(R.id.swWatchdog); swUpdates = view.findViewById(R.id.swUpdates); ibChannelUpdated = view.findViewById(R.id.ibChannelUpdated); swCheckWeekly = view.findViewById(R.id.swWeekly); @@ -294,6 +294,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc tvLastCleanup = view.findViewById(R.id.tvLastCleanup); cardAdvanced = view.findViewById(R.id.cardAdvanced); + swWatchdog = view.findViewById(R.id.swWatchdog); swExperiments = view.findViewById(R.id.swExperiments); tvExperimentsHint = view.findViewById(R.id.tvExperimentsHint); swProtocol = view.findViewById(R.id.swProtocol); @@ -599,13 +600,6 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc } }); - swWatchdog.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { - @Override - public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { - prefs.edit().putBoolean("watchdog", checked).apply(); - } - }); - swUpdates.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { @@ -677,6 +671,13 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc } }); + swWatchdog.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { + prefs.edit().putBoolean("watchdog", checked).apply(); + } + }); + tvExperimentsHint.setPaintFlags(tvExperimentsHint.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG); tvExperimentsHint.setOnClickListener(new View.OnClickListener() { @Override @@ -1684,7 +1685,6 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc spLanguage.setSelection(selected); swDeepL.setChecked(prefs.getBoolean("deepl_enabled", false)); - swWatchdog.setChecked(prefs.getBoolean("watchdog", true)); swUpdates.setChecked(prefs.getBoolean("updates", true)); swCheckWeekly.setChecked(prefs.getBoolean("weekly", Helper.hasPlayStore(getContext()))); swCheckWeekly.setEnabled(swUpdates.isChecked()); @@ -1694,6 +1694,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc tvUuid.setText(prefs.getString("uuid", null)); swCleanupAttachments.setChecked(prefs.getBoolean("cleanup_attachments", false)); + swWatchdog.setChecked(prefs.getBoolean("watchdog", true)); swProtocol.setChecked(prefs.getBoolean("protocol", false)); swLogInfo.setChecked(prefs.getInt("log_level", Log.getDefaultLogLevel()) <= android.util.Log.INFO); swDebug.setChecked(prefs.getBoolean("debug", false)); diff --git a/app/src/main/res/layout/fragment_options_misc.xml b/app/src/main/res/layout/fragment_options_misc.xml index a16aeef309..b312b672ed 100644 --- a/app/src/main/res/layout/fragment_options_misc.xml +++ b/app/src/main/res/layout/fragment_options_misc.xml @@ -344,18 +344,6 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/ibDeepL" /> - - + +