Added option to make unsnoozed messages important

pull/217/head
M66B 7 months ago
parent ebc15f66aa
commit a53038210a

@ -102,6 +102,7 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
private SwitchCompat swPhotoPicker;
private SwitchCompat swFlagSnoozed;
private SwitchCompat swFlagUnsnoozed;
private SwitchCompat swImportantUnsnoozed;
private SwitchCompat swAutoImportant;
private SwitchCompat swResetSnooze;
private SwitchCompat swAutoBlockSender;
@ -128,7 +129,7 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
"seen_delay",
"autoclose", "onclose", "autoclose_unseen", "autoclose_send", "collapse_marked",
"undo_timeout",
"autoread", "flag_snoozed", "flag_unsnoozed", "autounflag", "auto_important", "reset_importance",
"autoread", "flag_snoozed", "flag_unsnoozed", "autounflag", "important_unsnoozed", "auto_important", "reset_importance",
"reset_snooze", "auto_block_sender", "auto_hide_answer", "swipe_reply",
"move_thread_all", "move_thread_sent", "swipe_trash_all", "gmail_delete_all",
"default_folder"
@ -189,6 +190,7 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
swPhotoPicker = view.findViewById(R.id.swPhotoPicker);
swFlagSnoozed = view.findViewById(R.id.swFlagSnoozed);
swFlagUnsnoozed = view.findViewById(R.id.swFlagUnsnoozed);
swImportantUnsnoozed = view.findViewById(R.id.swImportantUnsnoozed);
swAutoImportant = view.findViewById(R.id.swAutoImportant);
swResetSnooze = view.findViewById(R.id.swResetSnooze);
swAutoBlockSender = view.findViewById(R.id.swAutoBlockSender);
@ -571,6 +573,13 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
}
});
swImportantUnsnoozed.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("important_unsnoozed", checked).apply();
}
});
swAutoImportant.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@ -801,6 +810,7 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
swFlagSnoozed.setChecked(prefs.getBoolean("flag_snoozed", false));
swFlagUnsnoozed.setChecked(prefs.getBoolean("flag_unsnoozed", false));
swFlagUnsnoozed.setEnabled(swFlagSnoozed.isChecked());
swImportantUnsnoozed.setChecked(prefs.getBoolean("important_unsnoozed", false));
swAutoImportant.setChecked(prefs.getBoolean("auto_important", false));
swResetSnooze.setChecked(prefs.getBoolean("reset_snooze", true));
swAutoBlockSender.setChecked(prefs.getBoolean("auto_block_sender", true));

@ -1382,6 +1382,7 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(ServiceSynchronize.this);
boolean threading = prefs.getBoolean("threading", true);
boolean flag_unsnoozed = prefs.getBoolean("flag_unsnoozed", false);
boolean important_unsnoozed = prefs.getBoolean("important_unsnoozed", false);
// Show thread
List<EntityMessage> messages = db.message().getMessagesByThread(
@ -1392,6 +1393,12 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
db.message().setMessageUnsnoozed(message.id, true);
if (flag_unsnoozed)
EntityOperation.queue(ServiceSynchronize.this, message, EntityOperation.FLAG, false);
if (important_unsnoozed) {
db.message().setMessageImportance(message.id, EntityMessage.PRIORITIY_HIGH);
EntityOperation.queue(ServiceSynchronize.this, message, EntityOperation.KEYWORD,
MessageHelper.FLAG_HIGH_IMPORTANCE, true);
}
EntityOperation.queue(ServiceSynchronize.this, message, EntityOperation.SEEN, false, false);
}

@ -822,6 +822,17 @@
app:layout_constraintTop_toBottomOf="@id/swFlagSnoozed"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swImportantUnsnoozed"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_advanced_important_unsnoozed"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swFlagUnsnoozed"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swAutoImportant"
android:layout_width="0dp"
@ -830,7 +841,7 @@
android:text="@string/title_advanced_auto_important"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swFlagUnsnoozed"
app:layout_constraintTop_toBottomOf="@id/swImportantUnsnoozed"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat

@ -751,6 +751,7 @@
<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_important_unsnoozed">Automatically make unsnoozing messages important</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