From 47e6c6a575de0c2fb95c3315afa0aaa718880137 Mon Sep 17 00:00:00 2001 From: M66B Date: Sat, 16 Apr 2022 18:23:39 +0200 Subject: [PATCH] Refactoring --- .../faircode/email/FragmentOptionsMisc.java | 43 ++++++++------- .../main/res/layout/fragment_options_misc.xml | 54 +++++++++---------- 2 files changed, 48 insertions(+), 49 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java b/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java index 62d830a44f..fc798d34a6 100644 --- a/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java +++ b/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java @@ -117,8 +117,6 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc private ImageButton ibChannelUpdated; private SwitchCompat swCheckWeekly; private SwitchCompat swChangelog; - private SwitchCompat swExperiments; - private TextView tvExperimentsHint; private SwitchCompat swCrashReports; private TextView tvUuid; private Button btnReset; @@ -127,6 +125,8 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc private TextView tvLastCleanup; private CardView cardAdvanced; + private SwitchCompat swExperiments; + private TextView tvExperimentsHint; private SwitchCompat swProtocol; private SwitchCompat swLogInfo; private SwitchCompat swDebug; @@ -206,8 +206,8 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc "classification", "class_min_probability", "class_min_difference", "language", "deepl_enabled", "watchdog", "updates", "weekly", "show_changelog", - "experiments", "crash_reports", "cleanup_attachments", - "protocol", "log_level", "debug", "leak_canary", "test1", "test2", "test3", "test4", "test5", + "crash_reports", "cleanup_attachments", + "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", @@ -286,8 +286,6 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc ibChannelUpdated = view.findViewById(R.id.ibChannelUpdated); swCheckWeekly = view.findViewById(R.id.swWeekly); swChangelog = view.findViewById(R.id.swChangelog); - swExperiments = view.findViewById(R.id.swExperiments); - tvExperimentsHint = view.findViewById(R.id.tvExperimentsHint); swCrashReports = view.findViewById(R.id.swCrashReports); tvUuid = view.findViewById(R.id.tvUuid); btnReset = view.findViewById(R.id.btnReset); @@ -296,6 +294,8 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc tvLastCleanup = view.findViewById(R.id.tvLastCleanup); cardAdvanced = view.findViewById(R.id.cardAdvanced); + swExperiments = view.findViewById(R.id.swExperiments); + tvExperimentsHint = view.findViewById(R.id.tvExperimentsHint); swProtocol = view.findViewById(R.id.swProtocol); swLogInfo = view.findViewById(R.id.swLogInfo); swDebug = view.findViewById(R.id.swDebug); @@ -645,21 +645,6 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc } }); - tvExperimentsHint.setPaintFlags(tvExperimentsHint.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG); - tvExperimentsHint.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - Helper.viewFAQ(v.getContext(), 125); - } - }); - - swExperiments.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { - @Override - public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { - prefs.edit().putBoolean("experiments", checked).apply(); - } - }); - swCrashReports.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { @@ -692,6 +677,21 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc } }); + tvExperimentsHint.setPaintFlags(tvExperimentsHint.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG); + tvExperimentsHint.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Helper.viewFAQ(v.getContext(), 125); + } + }); + + swExperiments.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { + prefs.edit().putBoolean("experiments", checked).apply(); + } + }); + swProtocol.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { @@ -706,7 +706,6 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc } }); - swLogInfo.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { diff --git a/app/src/main/res/layout/fragment_options_misc.xml b/app/src/main/res/layout/fragment_options_misc.xml index d5366e6458..46ac142a2a 100644 --- a/app/src/main/res/layout/fragment_options_misc.xml +++ b/app/src/main/res/layout/fragment_options_misc.xml @@ -402,31 +402,6 @@ app:layout_constraintTop_toBottomOf="@id/swWeekly" app:switchPadding="12dp" /> - - - - + + + +