From 3d7ae5e2e60075c909f13f765fcfeb62d8950123 Mon Sep 17 00:00:00 2001 From: M66B Date: Fri, 16 Dec 2022 16:13:44 +0100 Subject: [PATCH] Added option to cancel snooze on moving messages --- .../java/eu/faircode/email/EntityOperation.java | 4 +++- .../eu/faircode/email/FragmentOptionsBehavior.java | 13 ++++++++++++- .../main/res/layout/fragment_options_behavior.xml | 13 ++++++++++++- app/src/main/res/values/strings.xml | 1 + 4 files changed, 28 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/EntityOperation.java b/app/src/main/java/eu/faircode/email/EntityOperation.java index 10729aae7b..6511715108 100644 --- a/app/src/main/java/eu/faircode/email/EntityOperation.java +++ b/app/src/main/java/eu/faircode/email/EntityOperation.java @@ -210,6 +210,7 @@ public class EntityOperation { boolean autoread = prefs.getBoolean("autoread", false); boolean autounflag = prefs.getBoolean("autounflag", false); boolean reset_importance = prefs.getBoolean("reset_importance", false); + boolean reset_snooze = prefs.getBoolean("reset_snooze", false); if (jargs.opt(1) != null) { // rules, classify @@ -313,7 +314,8 @@ public class EntityOperation { } if (message.ui_snoozed != null && - (EntityFolder.ARCHIVE.equals(target.type) || + (reset_snooze || + EntityFolder.ARCHIVE.equals(target.type) || EntityFolder.TRASH.equals(target.type) || EntityFolder.JUNK.equals(target.type))) { message.ui_snoozed = null; diff --git a/app/src/main/java/eu/faircode/email/FragmentOptionsBehavior.java b/app/src/main/java/eu/faircode/email/FragmentOptionsBehavior.java index 8d1af840d0..59ba33e827 100644 --- a/app/src/main/java/eu/faircode/email/FragmentOptionsBehavior.java +++ b/app/src/main/java/eu/faircode/email/FragmentOptionsBehavior.java @@ -98,6 +98,7 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe private SwitchCompat swAutoUnflag; private SwitchCompat swAutoImportant; private SwitchCompat swResetImportance; + private SwitchCompat swResetSnooze; private SwitchCompat swSwipeReply; final static int MAX_SWIPE_SENSITIVITY = 10; @@ -111,7 +112,7 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe "autoexpand", "expand_first", "expand_all", "expand_one", "collapse_multiple", "autoclose", "onclose", "autoclose_unseen", "collapse_marked", "undo_timeout", - "autoread", "flag_snoozed", "autounflag", "auto_important", "reset_importance", + "autoread", "flag_snoozed", "autounflag", "auto_important", "reset_importance", "reset_snooze", "swipe_reply" }; @@ -165,6 +166,7 @@ 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); + swResetSnooze = view.findViewById(R.id.swResetSnooze); swSwipeReply = view.findViewById(R.id.swSwipeReply); setOptions(); @@ -496,6 +498,14 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe } }); + swResetSnooze.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { + prefs.edit().putBoolean("reset_snooze", checked).apply(); + } + }); + + swSwipeReply.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { @@ -614,6 +624,7 @@ 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)); + swResetSnooze.setChecked(prefs.getBoolean("reset_snooze", false)); swSwipeReply.setChecked(prefs.getBoolean("swipe_reply", false)); } diff --git a/app/src/main/res/layout/fragment_options_behavior.xml b/app/src/main/res/layout/fragment_options_behavior.xml index ce4aa10a1a..6f8f9334d6 100644 --- a/app/src/main/res/layout/fragment_options_behavior.xml +++ b/app/src/main/res/layout/fragment_options_behavior.xml @@ -711,6 +711,17 @@ app:layout_constraintTop_toBottomOf="@id/swAutoImportant" app:switchPadding="12dp" /> + + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index d4e3dbea8e..30619899e6 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -640,6 +640,7 @@ Automatically remove stars from messages on moving messages Automatically make starred messages important Reset importance on moving messages + Cancel snooze on moving messages Swipe expanded messages to the right to reply Default snooze/delay time