Added option to remove stars on unsnooze

pull/215/head
M66B 5 months ago
parent 4938e5c811
commit 1ae98ba5ca

@ -101,6 +101,7 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
private SwitchCompat swResetImportance;
private SwitchCompat swPhotoPicker;
private SwitchCompat swFlagSnoozed;
private SwitchCompat swFlagUnsnoozed;
private SwitchCompat swAutoImportant;
private SwitchCompat swResetSnooze;
private SwitchCompat swAutoBlockSender;
@ -126,7 +127,7 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
"seen_delay",
"autoclose", "onclose", "autoclose_unseen", "autoclose_send", "collapse_marked",
"undo_timeout",
"autoread", "flag_snoozed", "autounflag", "auto_important", "reset_importance",
"autoread", "flag_snoozed", "flag_unsnoozed", "autounflag", "auto_important", "reset_importance",
"reset_snooze", "auto_block_sender", "auto_hide_answer", "swipe_reply",
"move_thread_all", "move_thread_sent", "swipe_trash_all",
"default_folder"
@ -186,6 +187,7 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
swResetImportance = view.findViewById(R.id.swResetImportance);
swPhotoPicker = view.findViewById(R.id.swPhotoPicker);
swFlagSnoozed = view.findViewById(R.id.swFlagSnoozed);
swFlagUnsnoozed = view.findViewById(R.id.swFlagUnsnoozed);
swAutoImportant = view.findViewById(R.id.swAutoImportant);
swResetSnooze = view.findViewById(R.id.swResetSnooze);
swAutoBlockSender = view.findViewById(R.id.swAutoBlockSender);
@ -556,6 +558,14 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("flag_snoozed", checked).apply();
swFlagUnsnoozed.setEnabled(checked);
}
});
swFlagUnsnoozed.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("flag_unsnoozed", checked).apply();
}
});
@ -780,6 +790,8 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
swPhotoPicker.setChecked(prefs.getBoolean("photo_picker", true));
swFlagSnoozed.setChecked(prefs.getBoolean("flag_snoozed", false));
swFlagUnsnoozed.setChecked(prefs.getBoolean("flag_unsnoozed", false));
swFlagUnsnoozed.setEnabled(swFlagSnoozed.isChecked());
swAutoImportant.setChecked(prefs.getBoolean("auto_important", false));
swResetSnooze.setChecked(prefs.getBoolean("reset_snooze", true));
swAutoBlockSender.setChecked(prefs.getBoolean("auto_block_sender", true));

@ -1380,15 +1380,19 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
}
}
// Show thread
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(ServiceSynchronize.this);
boolean threading = prefs.getBoolean("threading", true);
boolean flag_unsnoozed = prefs.getBoolean("flag_unsnoozed", false);
// Show thread
List<EntityMessage> messages = db.message().getMessagesByThread(
message.account, message.thread, threading ? null : message.id, null);
for (EntityMessage threaded : messages)
db.message().setMessageSnoozed(threaded.id, null);
db.message().setMessageUnsnoozed(message.id, true);
if (flag_unsnoozed)
EntityOperation.queue(ServiceSynchronize.this, message, EntityOperation.FLAG, false);
EntityOperation.queue(ServiceSynchronize.this, message, EntityOperation.SEEN, false, false);
}

@ -810,6 +810,18 @@
app:layout_constraintTop_toBottomOf="@id/swPhotoPicker"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swFlagUnsnoozed"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginTop="12dp"
android:text="@string/title_advanced_star_unsnoozed"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swFlagSnoozed"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swAutoImportant"
android:layout_width="0dp"
@ -818,7 +830,7 @@
android:text="@string/title_advanced_auto_important"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swFlagSnoozed"
app:layout_constraintTop_toBottomOf="@id/swFlagUnsnoozed"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat

@ -735,6 +735,7 @@
<string name="title_advanced_autounstar">Automatically remove stars from messages on moving messages</string>
<string name="title_advanced_reset_importance">Reset importance on moving messages</string>
<string name="title_advanced_star_snoozed">Automatically add star on snoozing messages</string>
<string name="title_advanced_star_unsnoozed">Automatically remove star on unsnoozing messages</string>
<string name="title_advanced_auto_important">Automatically make starred messages important</string>
<string name="title_advanced_cancel_snooze">Cancel snooze on moving messages</string>
<string name="title_advanced_auto_block_sender">Automatically block the sender when reporting spam</string>

Loading…
Cancel
Save