Added option to star on snooze

This commit is contained in:
M66B 2020-02-16 13:49:05 +01:00
parent da37da22c4
commit 64c27bc279
3 changed files with 33 additions and 2 deletions

View File

@ -5629,6 +5629,9 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
if (wakeup < 0)
wakeup = null;
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
boolean flag_snoozed = prefs.getBoolean("flag_snoozed", false);
DB db = DB.getInstance(context);
try {
db.beginTransaction();
@ -5638,6 +5641,8 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
for (EntityMessage threaded : messages) {
db.message().setMessageSnoozed(threaded.id, wakeup);
db.message().setMessageUiIgnored(threaded.id, true);
if (flag_snoozed)
EntityOperation.queue(context, threaded, EntityOperation.FLAG, true);
EntityMessage.snooze(context, threaded.id, wakeup);
}
@ -5683,6 +5688,9 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
if (wakeup < 0)
wakeup = null;
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
boolean flag_snoozed = prefs.getBoolean("flag_snoozed", false);
DB db = DB.getInstance(context);
try {
db.beginTransaction();
@ -5697,6 +5705,8 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
for (EntityMessage threaded : messages) {
db.message().setMessageSnoozed(threaded.id, wakeup);
db.message().setMessageUiIgnored(message.id, true);
if (flag_snoozed)
EntityOperation.queue(context, threaded, EntityOperation.FLAG, true);
EntityMessage.snooze(context, threaded.id, wakeup);
}
}

View File

@ -57,6 +57,7 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
private SwitchCompat swQuickScroll;
private SwitchCompat swCollapseMultiple;
private SwitchCompat swAutoRead;
private SwitchCompat swFlagSnoozed;
private SwitchCompat swAutoUnflag;
private SwitchCompat swResetImportance;
private SwitchCompat swDiscardDelete;
@ -66,7 +67,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", "discard_delete",
"autoread", "flag_snoozed", "autounflag", "reset_importance", "discard_delete",
"default_snooze"
};
@ -96,6 +97,7 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
swQuickFilter = view.findViewById(R.id.swQuickFilter);
swQuickScroll = view.findViewById(R.id.swQuickScroll);
swAutoRead = view.findViewById(R.id.swAutoRead);
swFlagSnoozed = view.findViewById(R.id.swFlagSnoozed);
swAutoUnflag = view.findViewById(R.id.swAutoUnflag);
swResetImportance = view.findViewById(R.id.swResetImportance);
swDiscardDelete = view.findViewById(R.id.swDiscardDelete);
@ -236,6 +238,13 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
}
});
swFlagSnoozed.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("flag_snoozed", checked).apply();
}
});
swAutoUnflag.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@ -341,6 +350,7 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
swQuickScroll.setChecked(prefs.getBoolean("quick_scroll", true));
swAutoRead.setChecked(prefs.getBoolean("autoread", false));
swFlagSnoozed.setChecked(prefs.getBoolean("flag_snoozed", false));
swAutoUnflag.setChecked(prefs.getBoolean("autounflag", false));
swResetImportance.setChecked(prefs.getBoolean("reset_importance", false));
swDiscardDelete.setChecked(prefs.getBoolean("discard_delete", false));

View File

@ -243,6 +243,17 @@
app:layout_constraintTop_toBottomOf="@id/swQuickScroll"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swFlagSnoozed"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_advanced_star_snoozed"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swAutoRead"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swAutoUnflag"
android:layout_width="0dp"
@ -251,7 +262,7 @@
android:text="@string/title_advanced_autounstar"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swAutoRead"
app:layout_constraintTop_toBottomOf="@id/swFlagSnoozed"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat