mirror of
https://github.com/M66B/FairEmail.git
synced 2026-04-27 11:16:51 +02:00
Show mark seen in rule list
This commit is contained in:
@@ -264,8 +264,10 @@ public class AdapterRule extends RecyclerView.Adapter<AdapterRule.ViewHolder> {
|
||||
if (TextUtils.isEmpty(method))
|
||||
method = "GET";
|
||||
setAction(getAction(type), method + " " + url);
|
||||
} else
|
||||
setAction(getAction(type), null);
|
||||
} else {
|
||||
boolean seen = jaction.optBoolean("seen");
|
||||
setAction(getAction(type), seen ? context.getString(R.string.title_rule_seen) : null, null);
|
||||
}
|
||||
|
||||
if (type == EntityRule.TYPE_MOVE || type == EntityRule.TYPE_COPY ||
|
||||
(type == EntityRule.TYPE_ANSWER && TextUtils.isEmpty(to))) {
|
||||
@@ -302,7 +304,9 @@ public class AdapterRule extends RecyclerView.Adapter<AdapterRule.ViewHolder> {
|
||||
if (id != AdapterRule.this.getItemId(pos))
|
||||
return;
|
||||
|
||||
setAction(getAction(args.getInt("type")), value);
|
||||
boolean seen = jaction.optBoolean("seen");
|
||||
setAction(getAction(args.getInt("type")),
|
||||
seen ? context.getString(R.string.title_rule_seen) : null, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -565,16 +569,24 @@ public class AdapterRule extends RecyclerView.Adapter<AdapterRule.ViewHolder> {
|
||||
}
|
||||
|
||||
private void setAction(int resid, String value) {
|
||||
if (TextUtils.isEmpty(value))
|
||||
setAction(resid, null, value);
|
||||
}
|
||||
|
||||
private void setAction(int resid, String extra, String value) {
|
||||
if (TextUtils.isEmpty(extra) && TextUtils.isEmpty(value))
|
||||
tvAction.setText(resid);
|
||||
else {
|
||||
SpannableStringBuilder ssb = new SpannableStringBuilderEx();
|
||||
ssb.append(context.getString(resid));
|
||||
ssb.append(" \"");
|
||||
int start = ssb.length();
|
||||
ssb.append(value);
|
||||
ssb.setSpan(new StyleSpan(Typeface.ITALIC), start, ssb.length(), 0);
|
||||
ssb.append("\"");
|
||||
if (extra != null)
|
||||
ssb.append('+').append(extra);
|
||||
if (value != null) {
|
||||
ssb.append(" \"");
|
||||
int start = ssb.length();
|
||||
ssb.append(value);
|
||||
ssb.setSpan(new StyleSpan(Typeface.ITALIC), start, ssb.length(), 0);
|
||||
ssb.append("\"");
|
||||
}
|
||||
tvAction.setText(ssb);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user