From 74b7a93ba4ba8acae1ec44294a3119099a3e06cc Mon Sep 17 00:00:00 2001 From: M66B Date: Sun, 11 Jul 2021 21:04:47 +0200 Subject: [PATCH] Sent messages folder / account list --- .../java/eu/faircode/email/AdapterAccount.java | 4 ++++ .../main/java/eu/faircode/email/DaoAccount.java | 3 ++- .../java/eu/faircode/email/TupleAccountEx.java | 4 +++- app/src/main/res/layout/item_account.xml | 15 ++++++++++++++- 4 files changed, 23 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/AdapterAccount.java b/app/src/main/java/eu/faircode/email/AdapterAccount.java index 8669e976a4..7ebe1bf532 100644 --- a/app/src/main/java/eu/faircode/email/AdapterAccount.java +++ b/app/src/main/java/eu/faircode/email/AdapterAccount.java @@ -104,6 +104,7 @@ public class AdapterAccount extends RecyclerView.Adapter 0 || !settings ? View.GONE : View.VISIBLE); tvDrafts.setVisibility(account.drafts != null || !settings ? View.GONE : View.VISIBLE); + tvSent.setVisibility(account.protocol != EntityAccount.TYPE_IMAP || + account.sent != null || !settings ? View.GONE : View.VISIBLE); tvWarning.setText(account.warning); tvWarning.setVisibility(account.warning == null || !settings ? View.GONE : View.VISIBLE); diff --git a/app/src/main/java/eu/faircode/email/DaoAccount.java b/app/src/main/java/eu/faircode/email/DaoAccount.java index c21a9ecab3..622e2f17c3 100644 --- a/app/src/main/java/eu/faircode/email/DaoAccount.java +++ b/app/src/main/java/eu/faircode/email/DaoAccount.java @@ -66,9 +66,10 @@ public interface DaoAccount { " FROM identity" + " WHERE identity.account = account.id" + " AND identity.synchronize) AS identities" + - ", drafts.id AS drafts" + + ", drafts.id AS drafts, sent.id AS sent" + " FROM account" + " LEFT JOIN folder AS drafts ON drafts.account = account.id AND drafts.type = '" + EntityFolder.DRAFTS + "'" + + " LEFT JOIN folder AS sent ON sent.account = account.id AND sent.type = '" + EntityFolder.SENT + "'" + " WHERE :all OR account.synchronize" + " GROUP BY account.id" + " ORDER BY CASE WHEN :all THEN 0 ELSE account.`order` END" + diff --git a/app/src/main/java/eu/faircode/email/TupleAccountEx.java b/app/src/main/java/eu/faircode/email/TupleAccountEx.java index c208ac778b..3af8c9b6d5 100644 --- a/app/src/main/java/eu/faircode/email/TupleAccountEx.java +++ b/app/src/main/java/eu/faircode/email/TupleAccountEx.java @@ -25,6 +25,7 @@ public class TupleAccountEx extends EntityAccount { public int unseen; public int identities; // synchronizing public Long drafts; + public Long sent; @Override public boolean equals(Object obj) { @@ -33,7 +34,8 @@ public class TupleAccountEx extends EntityAccount { return (super.equals(obj) && this.unseen == other.unseen && this.identities == other.identities && - Objects.equals(this.drafts, other.drafts)); + Objects.equals(this.drafts, other.drafts) && + Objects.equals(this.sent, other.sent)); } else return false; } diff --git a/app/src/main/res/layout/item_account.xml b/app/src/main/res/layout/item_account.xml index e99cdf9ea7..1be892fd5a 100644 --- a/app/src/main/res/layout/item_account.xml +++ b/app/src/main/res/layout/item_account.xml @@ -251,6 +251,19 @@ app:layout_constraintStart_toEndOf="@id/vwColor" app:layout_constraintTop_toBottomOf="@id/tvIdentity" /> + + + app:layout_constraintTop_toBottomOf="@id/tvSent" />