diff --git a/app/src/main/java/eu/faircode/email/FragmentOptionsBehavior.java b/app/src/main/java/eu/faircode/email/FragmentOptionsBehavior.java index 3214ec6376..13a095a1b6 100644 --- a/app/src/main/java/eu/faircode/email/FragmentOptionsBehavior.java +++ b/app/src/main/java/eu/faircode/email/FragmentOptionsBehavior.java @@ -20,6 +20,7 @@ package eu.faircode.email; */ import android.content.SharedPreferences; +import android.os.Build; import android.os.Bundle; import android.text.Editable; import android.text.TextUtils; @@ -39,11 +40,14 @@ import android.widget.Toast; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.widget.SwitchCompat; +import androidx.constraintlayout.widget.Group; import androidx.lifecycle.Lifecycle; import androidx.preference.PreferenceManager; public class FragmentOptionsBehavior extends FragmentBase implements SharedPreferences.OnSharedPreferenceChangeListener { private SwitchCompat swDoubleBack; + private SwitchCompat swConversationActions; + private SwitchCompat swConversationActionsReplies; private EditText etDefaultSnooze; private SwitchCompat swPull; private SwitchCompat swAutoScroll; @@ -65,9 +69,10 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe private SwitchCompat swAutoImportant; private SwitchCompat swResetImportance; private SwitchCompat swDiscardDelete; + private Group grpConversationActions; private final static String[] RESET_OPTIONS = new String[]{ - "double_back", "default_snooze", + "double_back", "conversation_actions", "conversation_actions_replies", "default_snooze", "pull", "autoscroll", "quick_filter", "quick_scroll", "doubletap", "swipenav", "volumenav", "reversed", "autoexpand", "expand_all", "expand_one", "collapse_multiple", @@ -86,6 +91,8 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe // Get controls swDoubleBack = view.findViewById(R.id.swDoubleBack); + swConversationActions = view.findViewById(R.id.swConversationActions); + swConversationActionsReplies = view.findViewById(R.id.swConversationActionsReplies); etDefaultSnooze = view.findViewById(R.id.etDefaultSnooze); swPull = view.findViewById(R.id.swPull); swAutoScroll = view.findViewById(R.id.swAutoScroll); @@ -107,6 +114,7 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe swAutoImportant = view.findViewById(R.id.swAutoImportant); swResetImportance = view.findViewById(R.id.swResetImportance); swDiscardDelete = view.findViewById(R.id.swDiscardDelete); + grpConversationActions = view.findViewById(R.id.grpConversationActions); setOptions(); @@ -121,6 +129,21 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe } }); + swConversationActions.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { + prefs.edit().putBoolean("conversation_actions", checked).apply(); + swConversationActionsReplies.setEnabled(checked); + } + }); + + swConversationActionsReplies.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { + prefs.edit().putBoolean("conversation_actions_replies", checked).apply(); + } + }); + etDefaultSnooze.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { @@ -350,6 +373,9 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext()); swDoubleBack.setChecked(prefs.getBoolean("double_back", true)); + swConversationActions.setChecked(prefs.getBoolean("conversation_actions", true)); + swConversationActionsReplies.setChecked(prefs.getBoolean("conversation_actions_replies", true)); + swConversationActionsReplies.setEnabled(swConversationActions.isChecked()); int default_snooze = prefs.getInt("default_snooze", 1); etDefaultSnooze.setText(default_snooze == 1 ? null : Integer.toString(default_snooze)); etDefaultSnooze.setHint("1"); @@ -389,5 +415,7 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe swAutoImportant.setChecked(prefs.getBoolean("auto_important", false)); swResetImportance.setChecked(prefs.getBoolean("reset_importance", false)); swDiscardDelete.setChecked(prefs.getBoolean("discard_delete", false)); + + grpConversationActions.setVisibility(Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q ? View.VISIBLE : View.GONE); } } diff --git a/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java b/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java index 157d7b7df7..fd3a2e3f0c 100644 --- a/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java +++ b/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java @@ -27,7 +27,6 @@ import android.content.Intent; import android.content.SharedPreferences; import android.content.pm.PackageManager; import android.graphics.Paint; -import android.os.Build; import android.os.Bundle; import android.view.LayoutInflater; import android.view.Menu; @@ -54,8 +53,6 @@ import io.requery.android.database.sqlite.SQLiteDatabase; public class FragmentOptionsMisc extends FragmentBase implements SharedPreferences.OnSharedPreferenceChangeListener { private SwitchCompat swExternalSearch; private SwitchCompat swShortcuts; - private SwitchCompat swConversationActions; - private SwitchCompat swConversationActionsReplies; private SwitchCompat swFts; private TextView tvFtsIndexed; private TextView tvFtsPro; @@ -78,12 +75,10 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc private TextView tvStorageSpace; private TextView tvFingerprint; - private Group grpConversationActions; private Group grpDebug; private final static String[] RESET_OPTIONS = new String[]{ - "shortcuts", "conversation_actions", "conversation_actions_replies", - "fts", "english", "watchdog", "auto_optimize", "updates", "experiments", "crash_reports", "debug" + "shortcuts", "fts", "english", "watchdog", "auto_optimize", "updates", "experiments", "crash_reports", "debug" }; private final static String[] RESET_QUESTIONS = new String[]{ @@ -105,8 +100,6 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc swExternalSearch = view.findViewById(R.id.swExternalSearch); swShortcuts = view.findViewById(R.id.swShortcuts); - swConversationActions = view.findViewById(R.id.swConversationActions); - swConversationActionsReplies = view.findViewById(R.id.swConversationActionsReplies); swFts = view.findViewById(R.id.swFts); tvFtsIndexed = view.findViewById(R.id.tvFtsIndexed); tvFtsPro = view.findViewById(R.id.tvFtsPro); @@ -129,7 +122,6 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc tvStorageSpace = view.findViewById(R.id.tvStorageSpace); tvFingerprint = view.findViewById(R.id.tvFingerprint); - grpConversationActions = view.findViewById(R.id.grpConversationActions); grpDebug = view.findViewById(R.id.grpDebug); setOptions(); @@ -159,21 +151,6 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc } }); - swConversationActions.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { - @Override - public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { - prefs.edit().putBoolean("conversation_actions", checked).apply(); - swConversationActionsReplies.setEnabled(checked); - } - }); - - swConversationActionsReplies.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { - @Override - public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { - prefs.edit().putBoolean("conversation_actions_replies", checked).apply(); - } - }); - swFts.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { @@ -413,9 +390,6 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc swExternalSearch.setChecked(state != PackageManager.COMPONENT_ENABLED_STATE_DISABLED); swShortcuts.setChecked(prefs.getBoolean("shortcuts", true)); - swConversationActions.setChecked(prefs.getBoolean("conversation_actions", true)); - swConversationActionsReplies.setChecked(prefs.getBoolean("conversation_actions_replies", true)); - swConversationActionsReplies.setEnabled(swConversationActions.isChecked()); swFts.setChecked(prefs.getBoolean("fts", false)); swEnglish.setChecked(prefs.getBoolean("english", false)); swWatchdog.setChecked(prefs.getBoolean("watchdog", true)); @@ -440,7 +414,6 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc Helper.humanReadableByteCount(Helper.getTotalStorageSpace(), true))); tvFingerprint.setText(Helper.getFingerprint(getContext())); - grpConversationActions.setVisibility(Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q ? View.VISIBLE : View.GONE); grpDebug.setVisibility(swDebug.isChecked() || BuildConfig.DEBUG ? View.VISIBLE : View.GONE); } diff --git a/app/src/main/res/layout/fragment_options_behavior.xml b/app/src/main/res/layout/fragment_options_behavior.xml index d9c0aa8ab6..a9792aa383 100644 --- a/app/src/main/res/layout/fragment_options_behavior.xml +++ b/app/src/main/res/layout/fragment_options_behavior.xml @@ -40,6 +40,30 @@ app:layout_constraintTop_toBottomOf="@id/tvCaptionGeneral" app:switchPadding="12dp" /> + + + + + app:layout_constraintTop_toBottomOf="@id/swConversationActionsReplies" /> + + diff --git a/app/src/main/res/layout/fragment_options_misc.xml b/app/src/main/res/layout/fragment_options_misc.xml index 5ec3f1fb52..9372042750 100644 --- a/app/src/main/res/layout/fragment_options_misc.xml +++ b/app/src/main/res/layout/fragment_options_misc.xml @@ -64,30 +64,6 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/swShortcuts" /> - - - - - -