Added misc option for main log

This commit is contained in:
M66B 2022-06-26 08:10:42 +02:00
parent 7fb85bf969
commit 190e46ad31
3 changed files with 28 additions and 3 deletions

View File

@ -129,6 +129,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
private SwitchCompat swWatchdog;
private SwitchCompat swExperiments;
private TextView tvExperimentsHint;
private SwitchCompat swMainLog;
private SwitchCompat swProtocol;
private SwitchCompat swLogInfo;
private SwitchCompat swDebug;
@ -211,7 +212,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
"language", "deepl_enabled",
"updates", "weekly", "show_changelog",
"crash_reports", "cleanup_attachments",
"watchdog", "experiments", "protocol", "log_level", "debug", "leak_canary", "test1",
"watchdog", "experiments", "main_log", "protocol", "log_level", "debug", "leak_canary", "test1",
"test2", "test3", "test4", "test5",
"work_manager", // "external_storage",
"query_threads", "wal", "sqlite_checkpoints", "sqlite_analyze", "sqlite_cache",
@ -303,6 +304,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
swWatchdog = view.findViewById(R.id.swWatchdog);
swExperiments = view.findViewById(R.id.swExperiments);
tvExperimentsHint = view.findViewById(R.id.tvExperimentsHint);
swMainLog = view.findViewById(R.id.swMainLog);
swProtocol = view.findViewById(R.id.swProtocol);
swLogInfo = view.findViewById(R.id.swLogInfo);
swDebug = view.findViewById(R.id.swDebug);
@ -682,6 +684,13 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
}
});
swMainLog.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("main_log", checked).apply();
}
});
swProtocol.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@ -1722,6 +1731,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
swCleanupAttachments.setChecked(prefs.getBoolean("cleanup_attachments", false));
swWatchdog.setChecked(prefs.getBoolean("watchdog", true));
swMainLog.setChecked(prefs.getBoolean("main_log", false));
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

@ -567,17 +567,31 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swExperiments" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swMainLog"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:checked="true"
android:drawableStart="@drawable/twotone_list_alt_24"
android:drawablePadding="6dp"
android:text="@string/title_advanced_main_log"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvExperimentsHint"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swProtocol"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:drawableStart="@drawable/twotone_list_alt_24"
android:drawableStart="@drawable/twotone_compare_arrows_24"
android:drawablePadding="6dp"
android:text="@string/title_advanced_protocol"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvExperimentsHint"
app:layout_constraintTop_toBottomOf="@id/swMainLog"
app:switchPadding="12dp" />
<TextView

View File

@ -735,6 +735,7 @@
<string name="title_advanced_last_cleanup">Last cleanup: %1$s</string>
<string name="title_advanced_app">App settings</string>
<string name="title_advanced_more">More options</string>
<string name="title_advanced_main_log">Main logging</string>
<string name="title_advanced_protocol">Protocol logging</string>
<string name="title_advanced_log_info">Debug logging</string>
<string name="title_advanced_debug">Debug mode</string>