Added ignore rule action

This commit is contained in:
M66B
2019-09-22 11:54:29 +02:00
parent dff77e6a3f
commit 1c95dbea71
4 changed files with 17 additions and 1 deletions

View File

@@ -127,6 +127,9 @@ public class AdapterRule extends RecyclerView.Adapter<AdapterRule.ViewHolder> {
case EntityRule.TYPE_UNSEEN:
tvAction.setText(R.string.title_rule_unseen);
break;
case EntityRule.TYPE_IGNORE:
tvAction.setText(R.string.title_rule_ignore);
break;
case EntityRule.TYPE_SNOOZE:
tvAction.setText(R.string.title_rule_snooze);
break;

View File

@@ -92,6 +92,7 @@ public class EntityRule {
static final int TYPE_FLAG = 6;
static final int TYPE_COPY = 7;
static final int TYPE_SNOOZE = 8;
static final int TYPE_IGNORE = 9;
static final String ACTION_AUTOMATION = BuildConfig.APPLICATION_ID + ".AUTOMATION";
static final String EXTRA_RULE = "rule";
@@ -266,6 +267,8 @@ public class EntityRule {
return onActionSeen(context, message, true);
case TYPE_UNSEEN:
return onActionSeen(context, message, false);
case TYPE_IGNORE:
return onActionIgnore(context, message, jaction);
case TYPE_SNOOZE:
return onActionSnooze(context, message, jaction);
case TYPE_FLAG:
@@ -292,7 +295,15 @@ public class EntityRule {
return true;
}
private boolean onActionMove(Context context, EntityMessage message, JSONObject jargs) throws JSONException {
private boolean onActionIgnore(Context context, EntityMessage message, JSONObject jargs) {
DB db = DB.getInstance(context);
db.message().setMessageUiIgnored(message.id, true);
message.ui_ignored = true;
return true;
}
private boolean onActionMove(Context context, EntityMessage message, JSONObject jargs) {
long target = jargs.optLong("target", -1);
boolean seen = jargs.optBoolean("seen");
boolean thread = jargs.optBoolean("thread");

View File

@@ -329,6 +329,7 @@ public class FragmentRule extends FragmentBase {
List<Action> actions = new ArrayList<>();
actions.add(new Action(EntityRule.TYPE_SEEN, getString(R.string.title_rule_seen)));
actions.add(new Action(EntityRule.TYPE_UNSEEN, getString(R.string.title_rule_unseen)));
actions.add(new Action(EntityRule.TYPE_IGNORE, getString(R.string.title_rule_ignore)));
actions.add(new Action(EntityRule.TYPE_SNOOZE, getString(R.string.title_rule_snooze)));
actions.add(new Action(EntityRule.TYPE_FLAG, getString(R.string.title_rule_flag)));
actions.add(new Action(EntityRule.TYPE_MOVE, getString(R.string.title_rule_move)));