mirror of https://github.com/M66B/FairEmail.git
Added option to auto reset importance
This commit is contained in:
parent
0f446634c8
commit
3eb6822035
|
@ -301,7 +301,7 @@ public interface DaoMessage {
|
|||
|
||||
@Query("SELECT * FROM message" +
|
||||
" WHERE account = :account" +
|
||||
" AND (id = :id OR msgid = :msgid)")
|
||||
" AND (id = :id OR msgid = :msgid)")
|
||||
List<EntityMessage> getMessagesBySimilarity(long account, long id, String msgid);
|
||||
|
||||
@Query("SELECT COUNT(*) FROM message" +
|
||||
|
|
|
@ -172,6 +172,7 @@ public class EntityOperation {
|
|||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
boolean autoread = prefs.getBoolean("autoread", false);
|
||||
boolean autounflag = prefs.getBoolean("autounflag", false);
|
||||
boolean reset_importance = prefs.getBoolean("reset_importance", false);
|
||||
|
||||
if (jargs.opt(1) != null) // rules
|
||||
autoread = jargs.getBoolean(1);
|
||||
|
@ -188,12 +189,14 @@ public class EntityOperation {
|
|||
" target=" + target.id + ":" + target.name +
|
||||
" auto read=" + autoread + " flag=" + autounflag);
|
||||
|
||||
if (autoread || autounflag)
|
||||
if (autoread || autounflag || reset_importance)
|
||||
for (EntityMessage similar : db.message().getMessagesBySimilarity(message.account, message.id, message.msgid)) {
|
||||
if (autoread)
|
||||
db.message().setMessageUiSeen(similar.id, true);
|
||||
if (autounflag)
|
||||
db.message().setMessageUiFlagged(similar.id, false, null);
|
||||
if (reset_importance)
|
||||
db.message().setMessageImportance(similar.id, null);
|
||||
}
|
||||
|
||||
|
||||
|
@ -220,8 +223,11 @@ public class EntityOperation {
|
|||
long uid = message.uid;
|
||||
int notifying = message.notifying;
|
||||
boolean fts = message.fts;
|
||||
Integer importance = message.importance;
|
||||
boolean seen = message.seen;
|
||||
boolean flagged = message.flagged;
|
||||
boolean ui_seen = message.ui_seen;
|
||||
boolean ui_flagged = message.ui_flagged;
|
||||
Boolean ui_hide = message.ui_hide;
|
||||
boolean ui_browsed = message.ui_browsed;
|
||||
String error = message.error;
|
||||
|
@ -233,10 +239,16 @@ public class EntityOperation {
|
|||
message.uid = null;
|
||||
message.notifying = 0;
|
||||
message.fts = false;
|
||||
if (reset_importance)
|
||||
message.importance = null;
|
||||
if (autoread) {
|
||||
message.seen = true;
|
||||
message.ui_seen = true;
|
||||
}
|
||||
if (autounflag) {
|
||||
message.flagged = false;
|
||||
message.ui_flagged = false;
|
||||
}
|
||||
message.ui_hide = false;
|
||||
message.ui_browsed = false;
|
||||
message.error = null;
|
||||
|
@ -252,8 +264,11 @@ public class EntityOperation {
|
|||
message.uid = uid;
|
||||
message.notifying = notifying;
|
||||
message.fts = fts;
|
||||
message.importance = importance;
|
||||
message.seen = seen;
|
||||
message.flagged = flagged;
|
||||
message.ui_seen = ui_seen;
|
||||
message.ui_flagged = ui_flagged;
|
||||
message.ui_hide = ui_hide;
|
||||
message.ui_browsed = ui_browsed;
|
||||
message.error = error;
|
||||
|
|
|
@ -58,6 +58,7 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
|
|||
private SwitchCompat swCollapseMultiple;
|
||||
private SwitchCompat swAutoRead;
|
||||
private SwitchCompat swAutoUnflag;
|
||||
private SwitchCompat swResetImportance;
|
||||
private SwitchCompat swAutoMove;
|
||||
private SwitchCompat swDiscardDelete;
|
||||
private NumberPicker npDefaultSnooze;
|
||||
|
@ -65,7 +66,8 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
|
|||
private final static String[] RESET_OPTIONS = new String[]{
|
||||
"double_back", "pull", "autoscroll", "doubletap", "swipenav", "volumenav", "reversed",
|
||||
"autoexpand", "expand_all", "expand_one", "collapse_multiple",
|
||||
"autoclose", "onclose", "quick_filter", "quick_scroll", "autoread", "autounflag", "automove", "discard_delete",
|
||||
"autoclose", "onclose", "quick_filter", "quick_scroll",
|
||||
"autoread", "autounflag", "reset_importance", "automove", "discard_delete",
|
||||
"default_snooze"
|
||||
};
|
||||
|
||||
|
@ -96,6 +98,7 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
|
|||
swQuickScroll = view.findViewById(R.id.swQuickScroll);
|
||||
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);
|
||||
|
@ -242,6 +245,13 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
|
|||
}
|
||||
});
|
||||
|
||||
swResetImportance.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
prefs.edit().putBoolean("reset_importance", checked).apply();
|
||||
}
|
||||
});
|
||||
|
||||
swAutoMove.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
|
@ -341,6 +351,7 @@ 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));
|
||||
|
||||
|
|
|
@ -254,6 +254,17 @@
|
|||
app:layout_constraintTop_toBottomOf="@id/swAutoRead"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/swResetImportance"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:text="@string/title_advanced_reset_importance"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/swAutoUnflag"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/swAutoMove"
|
||||
android:layout_width="0dp"
|
||||
|
@ -262,7 +273,7 @@
|
|||
android:text="@string/title_advanced_automove"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/swAutoUnflag"
|
||||
app:layout_constraintTop_toBottomOf="@id/swResetImportance"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
|
|
|
@ -345,6 +345,7 @@
|
|||
<string name="title_advanced_quick_scroll">Show non-obtrusive quick scroll up/down icons</string>
|
||||
<string name="title_advanced_autoread">Automatically mark messages read on moving messages</string>
|
||||
<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_automove">Confirm moving messages</string>
|
||||
<string name="title_advanced_discard_delete">On discard draft permanently delete draft</string>
|
||||
<string name="title_advanced_default_snooze">Default snooze time</string>
|
||||
|
|
Loading…
Reference in New Issue