Moved watchdog to advanced

This commit is contained in:
M66B 2022-04-17 13:52:54 +02:00
parent 65ec2c625e
commit 49d8a0167b
2 changed files with 29 additions and 26 deletions

View File

@ -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));

View File

@ -344,18 +344,6 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/ibDeepL" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swWatchdog"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:checked="true"
android:text="@string/title_advanced_watchdog"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvSdcard"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swUpdates"
android:layout_width="0dp"
@ -365,7 +353,7 @@
android:text="@string/title_advanced_updates"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swWatchdog"
app:layout_constraintTop_toBottomOf="@id/tvSdcard"
app:switchPadding="12dp" />
<eu.faircode.email.FixedImageButton
@ -535,6 +523,20 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swWatchdog"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:checked="true"
android:drawableStart="@drawable/twotone_check_24"
android:drawablePadding="6dp"
android:text="@string/title_advanced_watchdog"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvCaptionAdvanced"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swExperiments"
android:layout_width="0dp"
@ -545,7 +547,7 @@
android:text="@string/title_advanced_experiments"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvCaptionAdvanced"
app:layout_constraintTop_toBottomOf="@id/swWatchdog"
app:switchPadding="12dp" />
<eu.faircode.email.FixedTextView