diff --git a/app/src/main/java/eu/faircode/email/EntityRule.java b/app/src/main/java/eu/faircode/email/EntityRule.java
index 7ab1858851..40f32c62d1 100644
--- a/app/src/main/java/eu/faircode/email/EntityRule.java
+++ b/app/src/main/java/eu/faircode/email/EntityRule.java
@@ -658,7 +658,7 @@ public class EntityRule {
case TYPE_UNSEEN:
return onActionSeen(context, message, false);
case TYPE_HIDE:
- return onActionHide(context, message);
+ return onActionHide(context, message, jaction);
case TYPE_IGNORE:
return onActionIgnore(context, message, jaction);
case TYPE_SNOOZE:
@@ -811,7 +811,9 @@ public class EntityRule {
return true;
}
- private boolean onActionHide(Context context, EntityMessage message) {
+ private boolean onActionHide(Context context, EntityMessage message, JSONObject jargs) {
+ boolean seen = jargs.optBoolean("seen");
+
DB db = DB.getInstance(context);
EntityFolder folder = db.folder().getFolder(message.folder);
@@ -824,7 +826,8 @@ public class EntityRule {
message.ui_snoozed = Long.MAX_VALUE;
message.ui_ignored = true;
- return true;
+
+ return (!seen || onActionSeen(context, message, true));
}
private boolean onActionIgnore(Context context, EntityMessage message, JSONObject jargs) {
diff --git a/app/src/main/java/eu/faircode/email/FragmentRule.java b/app/src/main/java/eu/faircode/email/FragmentRule.java
index e23e3f9a9a..92d6686a38 100644
--- a/app/src/main/java/eu/faircode/email/FragmentRule.java
+++ b/app/src/main/java/eu/faircode/email/FragmentRule.java
@@ -139,6 +139,8 @@ public class FragmentRule extends FragmentBase {
private Spinner spAction;
private TextView tvActionRemark;
+ private CheckBox cbHideSeen;
+
private NumberPicker npDuration;
private CheckBox cbScheduleEnd;
private CheckBox cbSnoozeSeen;
@@ -191,6 +193,7 @@ public class FragmentRule extends FragmentBase {
private Group grpReady;
private Group grpAge;
+ private Group grpHide;
private Group grpSnooze;
private Group grpFlag;
private Group grpImportance;
@@ -348,6 +351,8 @@ public class FragmentRule extends FragmentBase {
spAction = view.findViewById(R.id.spAction);
tvActionRemark = view.findViewById(R.id.tvActionRemark);
+ cbHideSeen = view.findViewById(R.id.cbHideSeen);
+
npDuration = view.findViewById(R.id.npDuration);
cbScheduleEnd = view.findViewById(R.id.cbScheduleEnd);
cbSnoozeSeen = view.findViewById(R.id.cbSnoozeSeen);
@@ -401,6 +406,7 @@ public class FragmentRule extends FragmentBase {
grpReady = view.findViewById(R.id.grpReady);
grpAge = view.findViewById(R.id.grpAge);
+ grpHide = view.findViewById(R.id.grpHide);
grpSnooze = view.findViewById(R.id.grpSnooze);
grpFlag = view.findViewById(R.id.grpFlag);
grpImportance = view.findViewById(R.id.grpImportance);
@@ -951,6 +957,7 @@ public class FragmentRule extends FragmentBase {
bottom_navigation.setVisibility(View.GONE);
grpReady.setVisibility(View.GONE);
grpAge.setVisibility(View.GONE);
+ grpHide.setVisibility(View.GONE);
grpSnooze.setVisibility(View.GONE);
grpFlag.setVisibility(View.GONE);
grpImportance.setVisibility(View.GONE);
@@ -1417,6 +1424,10 @@ public class FragmentRule extends FragmentBase {
} else {
int type = jaction.getInt("type");
switch (type) {
+ case EntityRule.TYPE_HIDE:
+ cbHideSeen.setChecked(jaction.optBoolean("seen", false));
+ break;
+
case EntityRule.TYPE_SNOOZE:
npDuration.setValue(jaction.optInt("duration", 0));
cbScheduleEnd.setChecked(jaction.optBoolean("schedule_end", false));
@@ -1554,6 +1565,7 @@ public class FragmentRule extends FragmentBase {
}
private void showActionParameters(int type) {
+ grpHide.setVisibility(type == EntityRule.TYPE_HIDE ? View.VISIBLE : View.GONE);
grpSnooze.setVisibility(type == EntityRule.TYPE_SNOOZE ? View.VISIBLE : View.GONE);
grpFlag.setVisibility(type == EntityRule.TYPE_FLAG ? View.VISIBLE : View.GONE);
grpImportance.setVisibility(type == EntityRule.TYPE_IMPORTANCE ? View.VISIBLE : View.GONE);
@@ -1863,6 +1875,10 @@ public class FragmentRule extends FragmentBase {
if (action != null) {
jaction.put("type", action.type);
switch (action.type) {
+ case EntityRule.TYPE_HIDE:
+ jaction.put("seen", cbHideSeen.isChecked());
+ break;
+
case EntityRule.TYPE_SNOOZE:
jaction.put("duration", npDuration.getValue());
jaction.put("schedule_end", cbScheduleEnd.isChecked());
diff --git a/app/src/main/res/layout/fragment_rule.xml b/app/src/main/res/layout/fragment_rule.xml
index 6053b3fe2e..5aaefdbc85 100644
--- a/app/src/main/res/layout/fragment_rule.xml
+++ b/app/src/main/res/layout/fragment_rule.xml
@@ -964,7 +964,7 @@
app:layout_constraintTop_toBottomOf="@id/npDuration" />
+
+
+
+