From eed9527bef3b9de5f7913467ea800b3e1ee4b626 Mon Sep 17 00:00:00 2001 From: M66B Date: Fri, 7 Feb 2020 13:01:33 +0100 Subject: [PATCH] Separately confirm moving one / multiple messages --- .../main/java/eu/faircode/email/ApplicationEx.java | 6 ++++++ .../java/eu/faircode/email/FragmentMessages.java | 6 ++++-- .../eu/faircode/email/FragmentOptionsBehavior.java | 12 +----------- .../java/eu/faircode/email/FragmentOptionsMisc.java | 2 +- .../main/res/layout/fragment_options_behavior.xml | 13 +------------ app/src/main/res/values/strings.xml | 1 - 6 files changed, 13 insertions(+), 27 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/ApplicationEx.java b/app/src/main/java/eu/faircode/email/ApplicationEx.java index 1da737b0b7..26ed05fec1 100644 --- a/app/src/main/java/eu/faircode/email/ApplicationEx.java +++ b/app/src/main/java/eu/faircode/email/ApplicationEx.java @@ -230,6 +230,12 @@ public class ApplicationEx extends Application { boolean large = context.getResources().getConfiguration() .isLayoutSizeAtLeast(Configuration.SCREENLAYOUT_SIZE_LARGE); editor.putBoolean("landscape3", large); + } else if (version < 949) { + if (prefs.contains("automove")) { + boolean automove = prefs.getBoolean("automove", false); + editor.putBoolean("move_1_confirmed", automove); + editor.remove("automove"); + } } if (BuildConfig.DEBUG && false) { diff --git a/app/src/main/java/eu/faircode/email/FragmentMessages.java b/app/src/main/java/eu/faircode/email/FragmentMessages.java index bbc0c5dc81..061d91daf5 100644 --- a/app/src/main/java/eu/faircode/email/FragmentMessages.java +++ b/app/src/main/java/eu/faircode/email/FragmentMessages.java @@ -3936,8 +3936,10 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences. return; } + String key = (result.size() == 1 ? "move_1_confirmed" : "move_n_confirmed"); + SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext()); - if (prefs.getBoolean("automove", false)) { + if (prefs.getBoolean(key, false)) { if (canUndo) moveUndo(result); else @@ -3949,7 +3951,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences. aargs.putString("question", getResources() .getQuantityString(R.plurals.title_moving_messages, result.size(), result.size(), getDisplay(result))); - aargs.putString("notagain", "automove"); + aargs.putString("notagain", key); aargs.putParcelableArrayList("result", result); FragmentDialogAsk ask = new FragmentDialogAsk(); diff --git a/app/src/main/java/eu/faircode/email/FragmentOptionsBehavior.java b/app/src/main/java/eu/faircode/email/FragmentOptionsBehavior.java index 4e15c5d33d..315dad49a7 100644 --- a/app/src/main/java/eu/faircode/email/FragmentOptionsBehavior.java +++ b/app/src/main/java/eu/faircode/email/FragmentOptionsBehavior.java @@ -59,7 +59,6 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe private SwitchCompat swAutoRead; private SwitchCompat swAutoUnflag; private SwitchCompat swResetImportance; - private SwitchCompat swAutoMove; private SwitchCompat swDiscardDelete; private NumberPicker npDefaultSnooze; @@ -67,7 +66,7 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe "double_back", "pull", "autoscroll", "doubletap", "swipenav", "volumenav", "reversed", "autoexpand", "expand_all", "expand_one", "collapse_multiple", "autoclose", "onclose", "quick_filter", "quick_scroll", - "autoread", "autounflag", "reset_importance", "automove", "discard_delete", + "autoread", "autounflag", "reset_importance", "discard_delete", "default_snooze" }; @@ -99,7 +98,6 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe swAutoRead = view.findViewById(R.id.swAutoRead); swAutoUnflag = view.findViewById(R.id.swAutoUnflag); swResetImportance = view.findViewById(R.id.swResetImportance); - swAutoMove = view.findViewById(R.id.swAutoMove); swDiscardDelete = view.findViewById(R.id.swDiscardDelete); npDefaultSnooze = view.findViewById(R.id.npDefaultSnooze); @@ -252,13 +250,6 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe } }); - swAutoMove.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { - @Override - public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { - prefs.edit().putBoolean("automove", !checked).apply(); - } - }); - swDiscardDelete.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { @@ -352,7 +343,6 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe swAutoRead.setChecked(prefs.getBoolean("autoread", false)); swAutoUnflag.setChecked(prefs.getBoolean("autounflag", false)); swResetImportance.setChecked(prefs.getBoolean("reset_importance", false)); - swAutoMove.setChecked(!prefs.getBoolean("automove", false)); swDiscardDelete.setChecked(prefs.getBoolean("discard_delete", false)); npDefaultSnooze.setValue(prefs.getInt("default_snooze", 1)); diff --git a/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java b/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java index f47f5f6e9b..b27fce5c13 100644 --- a/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java +++ b/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java @@ -78,7 +78,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc private final static String[] RESET_QUESTIONS = new String[]{ "welcome", "crash_reports_asked", "review_asked", "review_later", "why", - "reply_hint", "html_always_images", "print_html_confirmed", "automove", + "reply_hint", "html_always_images", "print_html_confirmed", "move_1_confirmed", "move_n_confirmed", "identities_asked", "cc_bcc", "inline_image_hint", "compose_reference", "send_dialog", "setup_advanced" }; diff --git a/app/src/main/res/layout/fragment_options_behavior.xml b/app/src/main/res/layout/fragment_options_behavior.xml index 4c58211adb..9eeb60301b 100644 --- a/app/src/main/res/layout/fragment_options_behavior.xml +++ b/app/src/main/res/layout/fragment_options_behavior.xml @@ -265,17 +265,6 @@ app:layout_constraintTop_toBottomOf="@id/swAutoUnflag" app:switchPadding="12dp" /> - - Automatically mark messages read on moving messages Automatically remove stars from messages on moving messages Reset importance on moving messages - Confirm moving messages On discard draft permanently delete draft Default snooze time