Filter system keywords

This commit is contained in:
M66B 2020-01-27 13:59:05 +01:00
parent b155cbf36f
commit c535df7e62
1 changed files with 12 additions and 2 deletions

View File

@ -259,6 +259,11 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
"fbclid" "fbclid"
)); ));
// https://www.iana.org/assignments/imap-jmap-keywords/imap-jmap-keywords.xhtml
private static final List<String> IMAP_KEYWORDS = Collections.unmodifiableList(Arrays.asList(
"$Phishing"
));
public class ViewHolder extends RecyclerView.ViewHolder implements public class ViewHolder extends RecyclerView.ViewHolder implements
View.OnKeyListener, View.OnKeyListener,
View.OnClickListener, View.OnClickListener,
@ -863,8 +868,13 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
// Line 2 // Line 2
tvSubject.setText(message.subject); tvSubject.setText(message.subject);
tvKeywords.setVisibility(message.keywords.length > 0 ? View.VISIBLE : View.GONE); List<String> keywords = new ArrayList<>();
tvKeywords.setText(TextUtils.join(" ", message.keywords)); for (String keyword : message.keywords)
if (!keyword.startsWith("$") || IMAP_KEYWORDS.contains(keyword))
keywords.add(keyword);
tvKeywords.setVisibility(keywords.size() > 0 ? View.VISIBLE : View.GONE);
tvKeywords.setText(TextUtils.join(" ", keywords));
// Line 3 // Line 3
int icon = (message.drafts > 0 int icon = (message.drafts > 0