diff --git a/app/src/main/java/eu/faircode/email/FragmentOptionsBehavior.java b/app/src/main/java/eu/faircode/email/FragmentOptionsBehavior.java index dcf7bc064a..e933b0f517 100644 --- a/app/src/main/java/eu/faircode/email/FragmentOptionsBehavior.java +++ b/app/src/main/java/eu/faircode/email/FragmentOptionsBehavior.java @@ -79,7 +79,6 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe private SwitchCompat swAutoUnflag; private SwitchCompat swAutoImportant; private SwitchCompat swResetImportance; - private SwitchCompat swDiscardDelete; private Group grpConversationActions; private final static String[] RESET_OPTIONS = new String[]{ @@ -89,7 +88,7 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe "doubletap", "swipenav", "volumenav", "reversed", "autoexpand", "expand_all", "expand_one", "collapse_multiple", "autoclose", "onclose", - "autoread", "flag_snoozed", "autounflag", "auto_important", "reset_importance", "discard_delete", + "autoread", "flag_snoozed", "autounflag", "auto_important", "reset_importance" }; @Override @@ -127,7 +126,6 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe swAutoUnflag = view.findViewById(R.id.swAutoUnflag); 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(); @@ -344,13 +342,6 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe } }); - swDiscardDelete.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { - @Override - public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { - prefs.edit().putBoolean("discard_delete", checked).apply(); - } - }); - PreferenceManager.getDefaultSharedPreferences(getContext()).registerOnSharedPreferenceChangeListener(this); return view; @@ -444,7 +435,6 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe swAutoUnflag.setChecked(prefs.getBoolean("autounflag", false)); 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/FragmentOptionsSend.java b/app/src/main/java/eu/faircode/email/FragmentOptionsSend.java index da21df32d1..96192cc12c 100644 --- a/app/src/main/java/eu/faircode/email/FragmentOptionsSend.java +++ b/app/src/main/java/eu/faircode/email/FragmentOptionsSend.java @@ -58,6 +58,7 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc private Spinner spSignatureLocation; private SwitchCompat swSignatureReply; private SwitchCompat swSignatureForward; + private SwitchCompat swDiscardDelete; private SwitchCompat swPlainOnly; private SwitchCompat swFormatFlowed; @@ -72,6 +73,7 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc "send_reminders", "send_delayed", "autolist", "prefix_once", "extended_reply", "quote_reply", "resize_reply", "signature_location", "signature_reply", "signature_forward", + "discard_delete", "plain_only", "format_flowed", "usenet_signature", "remove_signatures", "receipt_default", "receipt_type", "lookup_mx" }; @@ -102,6 +104,7 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc spSignatureLocation = view.findViewById(R.id.spSignatureLocation); swSignatureReply = view.findViewById(R.id.swSignatureReply); swSignatureForward = view.findViewById(R.id.swSignatureForward); + swDiscardDelete = view.findViewById(R.id.swDiscardDelete); swPlainOnly = view.findViewById(R.id.swPlainOnly); swFormatFlowed = view.findViewById(R.id.swFormatFlowed); @@ -236,6 +239,13 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc } }); + swDiscardDelete.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { + prefs.edit().putBoolean("discard_delete", checked).apply(); + } + }); + swPlainOnly.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { @@ -362,6 +372,7 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc swSignatureReply.setChecked(prefs.getBoolean("signature_reply", true)); swSignatureForward.setChecked(prefs.getBoolean("signature_forward", true)); + swDiscardDelete.setChecked(prefs.getBoolean("discard_delete", false)); swPlainOnly.setChecked(prefs.getBoolean("plain_only", false)); swFormatFlowed.setChecked(prefs.getBoolean("format_flowed", false)); diff --git a/app/src/main/res/layout/fragment_options_behavior.xml b/app/src/main/res/layout/fragment_options_behavior.xml index 3410d5348b..cbf2ba2a0d 100644 --- a/app/src/main/res/layout/fragment_options_behavior.xml +++ b/app/src/main/res/layout/fragment_options_behavior.xml @@ -422,17 +422,6 @@ app:layout_constraintTop_toBottomOf="@id/swAutoImportant" app:switchPadding="12dp" /> - - + + + app:layout_constraintTop_toBottomOf="@+id/swDiscardDelete" />