From 4beb4eb8d049ba74ab0aa7c939643f13beac9118 Mon Sep 17 00:00:00 2001 From: M66B Date: Sun, 25 Nov 2018 18:29:11 +0100 Subject: [PATCH] Show keywords --- .../java/eu/faircode/email/AdapterMessage.java | 5 +++++ app/src/main/java/eu/faircode/email/DB.java | 2 +- .../eu/faircode/email/ServiceSynchronize.java | 8 ++++---- app/src/main/res/layout/item_message_compact.xml | 15 ++++++++++++++- app/src/main/res/layout/item_message_normal.xml | 15 ++++++++++++++- 5 files changed, 38 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/AdapterMessage.java b/app/src/main/java/eu/faircode/email/AdapterMessage.java index 06f7f08b7f..e892f6d22f 100644 --- a/app/src/main/java/eu/faircode/email/AdapterMessage.java +++ b/app/src/main/java/eu/faircode/email/AdapterMessage.java @@ -162,6 +162,7 @@ public class AdapterMessage extends PagedListAdapter 0 ? View.VISIBLE : View.GONE); tvHeaders.setText(show_headers ? message.headers : null); diff --git a/app/src/main/java/eu/faircode/email/DB.java b/app/src/main/java/eu/faircode/email/DB.java index 69d333e493..2b5c6659e3 100644 --- a/app/src/main/java/eu/faircode/email/DB.java +++ b/app/src/main/java/eu/faircode/email/DB.java @@ -186,7 +186,7 @@ public abstract class DB extends RoomDatabase { if (value == null) return new String[0]; else - return TextUtils.split(" ", value); + return TextUtils.split(value, " "); } @TypeConverter diff --git a/app/src/main/java/eu/faircode/email/ServiceSynchronize.java b/app/src/main/java/eu/faircode/email/ServiceSynchronize.java index 283b78b1b1..c91f9c15f3 100644 --- a/app/src/main/java/eu/faircode/email/ServiceSynchronize.java +++ b/app/src/main/java/eu/faircode/email/ServiceSynchronize.java @@ -1505,9 +1505,10 @@ public class ServiceSynchronize extends LifecycleService { imessage.setFlags(flags, set); List keywords = new ArrayList<>(Arrays.asList(message.keywords)); - if (set) - keywords.add(keyword); - else + if (set) { + if (!keywords.contains(keyword)) + keywords.add(keyword); + } else keywords.remove(keyword); db.message().setMessageKeywords(message.id, DB.Converters.fromStringArray(keywords.toArray(new String[0]))); } @@ -2155,7 +2156,6 @@ public class ServiceSynchronize extends LifecycleService { if (message.ui_hide && full) { update = true; message.ui_hide = false; - db.message().updateMessage(message); Log.i(Helper.TAG, folder.name + " updated id=" + message.id + " uid=" + message.uid + " unhide"); } diff --git a/app/src/main/res/layout/item_message_compact.xml b/app/src/main/res/layout/item_message_compact.xml index f25143bd27..f684df4851 100644 --- a/app/src/main/res/layout/item_message_compact.xml +++ b/app/src/main/res/layout/item_message_compact.xml @@ -416,6 +416,19 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/tvTimeReceived" /> + + + app:layout_constraintTop_toBottomOf="@id/tvKeywords" /> + + + app:layout_constraintTop_toBottomOf="@id/tvKeywords" />