From cf3b4ac1307dae0e309f883ec3bdfcb07d11a427 Mon Sep 17 00:00:00 2001 From: M66B Date: Sun, 28 Feb 2021 08:21:24 +0100 Subject: [PATCH] Moved query threads to debug mode --- .../faircode/email/FragmentOptionsMisc.java | 46 ++++---- .../main/res/layout/fragment_options_misc.xml | 103 +++++++++--------- 2 files changed, 77 insertions(+), 72 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java b/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java index 85a528ef3d..68f7846e46 100644 --- a/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java +++ b/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java @@ -97,8 +97,6 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc private SwitchCompat swUpdates; private SwitchCompat swExperiments; private TextView tvExperimentsHint; - private SwitchCompat swQueries; - private SwitchCompat swWal; private SwitchCompat swCrashReports; private TextView tvUuid; private Button btnReset; @@ -111,6 +109,8 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc private SwitchCompat swProtocol; private SwitchCompat swLogInfo; private SwitchCompat swDebug; + private SwitchCompat swQueries; + private SwitchCompat swWal; private SwitchCompat swExpunge; private SwitchCompat swAuthPlain; private SwitchCompat swAuthLogin; @@ -194,8 +194,6 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc swUpdates = view.findViewById(R.id.swUpdates); swExperiments = view.findViewById(R.id.swExperiments); tvExperimentsHint = view.findViewById(R.id.tvExperimentsHint); - swQueries = view.findViewById(R.id.swQueries); - swWal = view.findViewById(R.id.swWal); swCrashReports = view.findViewById(R.id.swCrashReports); tvUuid = view.findViewById(R.id.tvUuid); btnReset = view.findViewById(R.id.btnReset); @@ -208,6 +206,8 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc swProtocol = view.findViewById(R.id.swProtocol); swLogInfo = view.findViewById(R.id.swLogInfo); swDebug = view.findViewById(R.id.swDebug); + swQueries = view.findViewById(R.id.swQueries); + swWal = view.findViewById(R.id.swWal); swExpunge = view.findViewById(R.id.swExpunge); swAuthPlain = view.findViewById(R.id.swAuthPlain); swAuthLogin = view.findViewById(R.id.swAuthLogin); @@ -398,23 +398,6 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc } }); - swQueries.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { - @Override - public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { - if (checked) - prefs.edit().putInt("query_threads", 2).commit(); // apply won't work here - else - prefs.edit().remove("query_threads").commit(); // apply won't work here - } - }); - - swWal.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { - @Override - public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { - prefs.edit().putBoolean("wal", checked).commit(); // apply won't work here - } - }); - swCrashReports.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { @@ -484,6 +467,23 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc } }); + swQueries.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { + if (checked) + prefs.edit().putInt("query_threads", 2).commit(); // apply won't work here + else + prefs.edit().remove("query_threads").commit(); // apply won't work here + } + }); + + swWal.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { + prefs.edit().putBoolean("wal", checked).commit(); // apply won't work here + } + }); + swProtocol.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { @@ -868,8 +868,6 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc Helper.isPlayStoreInstall() || !Helper.hasValidFingerprint(getContext()) ? View.GONE : View.VISIBLE); swExperiments.setChecked(prefs.getBoolean("experiments", false)); - swQueries.setChecked(prefs.getInt("query_threads", 4) < 4); - swWal.setChecked(prefs.getBoolean("wal", true)); swCrashReports.setChecked(prefs.getBoolean("crash_reports", false)); tvUuid.setText(prefs.getString("uuid", null)); swCleanupAttachments.setChecked(prefs.getBoolean("cleanup_attachments", false)); @@ -877,6 +875,8 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc swProtocol.setChecked(prefs.getBoolean("protocol", false)); swLogInfo.setChecked(prefs.getInt("log_level", Log.getDefaultLogLevel()) <= android.util.Log.INFO); swDebug.setChecked(prefs.getBoolean("debug", false)); + swQueries.setChecked(prefs.getInt("query_threads", 4) < 4); + swWal.setChecked(prefs.getBoolean("wal", true)); swExpunge.setChecked(prefs.getBoolean("perform_expunge", true)); swAuthPlain.setChecked(prefs.getBoolean("auth_plain", true)); swAuthLogin.setChecked(prefs.getBoolean("auth_login", true)); diff --git a/app/src/main/res/layout/fragment_options_misc.xml b/app/src/main/res/layout/fragment_options_misc.xml index 53450c441c..7e16494b14 100644 --- a/app/src/main/res/layout/fragment_options_misc.xml +++ b/app/src/main/res/layout/fragment_options_misc.xml @@ -303,52 +303,6 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/swExperiments" /> - - - - - - - - + + + + + + + + + app:constraint_referenced_ids=" + swQueries,tvQueriesHint,tvQueriesRemark,swWal, + swExpunge, + swAuthPlain,swAuthLogin,swAuthNtlm,swAuthSasl, + tvProcessors,tvMemoryClass,tvMemoryUsage,tvStorageUsage, + tvFingerprint,btnCharsets,btnCiphers,btnFiles" />