From fba7599c8c4cf6d1a7da2789d49a7592e624e662 Mon Sep 17 00:00:00 2001 From: M66B Date: Fri, 21 Aug 2020 07:42:45 +0200 Subject: [PATCH] Revert "Removed drafts warning from identities" This reverts commit 1dee158194e30ab001d131301b1757203f033253. --- .../java/eu/faircode/email/AdapterIdentity.java | 4 ++++ .../main/java/eu/faircode/email/DaoIdentity.java | 9 +++++---- .../java/eu/faircode/email/TupleIdentityEx.java | 4 +++- app/src/main/res/layout/item_identity.xml | 15 ++++++++++++++- 4 files changed, 26 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/AdapterIdentity.java b/app/src/main/java/eu/faircode/email/AdapterIdentity.java index 6f83f4ed17..7c27bbeefc 100644 --- a/app/src/main/java/eu/faircode/email/AdapterIdentity.java +++ b/app/src/main/java/eu/faircode/email/AdapterIdentity.java @@ -80,6 +80,7 @@ public class AdapterIdentity extends RecyclerView.Adapter> liveIdentityView(); - @Query("SELECT identity.*, account.name AS accountName" + + @Query("SELECT identity.*, account.name AS accountName, folder.id AS drafts" + " FROM identity" + - " JOIN account ON account.id = identity.account") + " JOIN account ON account.id = identity.account" + + " LEFT JOIN folder ON folder.account = account.id AND folder.type = '" + EntityFolder.DRAFTS + "'") LiveData> liveIdentities(); - @Query("SELECT identity.*, account.name AS accountName" + + @Query("SELECT identity.*, account.name AS accountName, folder.id AS drafts" + " FROM identity" + " JOIN account ON account.id = identity.account" + " JOIN folder ON folder.account = identity.account AND folder.type = '" + EntityFolder.DRAFTS + "'" + @@ -45,7 +46,7 @@ public interface DaoIdentity { " AND account.synchronize") LiveData> liveComposableIdentities(); - @Query("SELECT identity.*, account.name AS accountName" + + @Query("SELECT identity.*, account.name AS accountName, folder.id AS drafts" + " FROM identity" + " JOIN account ON account.id = identity.account" + " JOIN folder ON folder.account = identity.account AND folder.type = '" + EntityFolder.DRAFTS + "'" + diff --git a/app/src/main/java/eu/faircode/email/TupleIdentityEx.java b/app/src/main/java/eu/faircode/email/TupleIdentityEx.java index f6f371b9c9..5f1e71de90 100644 --- a/app/src/main/java/eu/faircode/email/TupleIdentityEx.java +++ b/app/src/main/java/eu/faircode/email/TupleIdentityEx.java @@ -23,13 +23,15 @@ import java.util.Objects; public class TupleIdentityEx extends EntityIdentity { public String accountName; + public Long drafts; @Override public boolean equals(Object obj) { if (obj instanceof TupleIdentityEx) { TupleIdentityEx other = (TupleIdentityEx) obj; return (super.equals(obj) && - Objects.equals(accountName, other.accountName)); + Objects.equals(accountName, other.accountName) && + Objects.equals(drafts, other.drafts)); } else return false; } diff --git a/app/src/main/res/layout/item_identity.xml b/app/src/main/res/layout/item_identity.xml index 13bf26cbd7..5918f41dc0 100644 --- a/app/src/main/res/layout/item_identity.xml +++ b/app/src/main/res/layout/item_identity.xml @@ -178,6 +178,19 @@ app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="@id/tvLast" /> + + + app:layout_constraintTop_toBottomOf="@id/tvDrafts" />