diff --git a/app/src/main/java/eu/faircode/email/AdapterAccount.java b/app/src/main/java/eu/faircode/email/AdapterAccount.java index a6a547709f..a369ef5611 100644 --- a/app/src/main/java/eu/faircode/email/AdapterAccount.java +++ b/app/src/main/java/eu/faircode/email/AdapterAccount.java @@ -202,7 +202,7 @@ public class AdapterAccount extends RecyclerView.Adapter 0 || !settings ? View.GONE : View.VISIBLE); - tvDrafts.setVisibility(account.drafts || !settings ? View.GONE : View.VISIBLE); + tvDrafts.setVisibility(account.drafts != 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 2873d7d936..f79effea09 100644 --- a/app/src/main/java/eu/faircode/email/DaoAccount.java +++ b/app/src/main/java/eu/faircode/email/DaoAccount.java @@ -63,7 +63,7 @@ public interface DaoAccount { " FROM identity" + " WHERE identity.account = account.id" + " AND identity.synchronize) AS identities" + - ", CASE WHEN drafts.id IS NULL THEN 0 ELSE 1 END AS drafts" + + ", drafts.id AS drafts" + " FROM account" + " LEFT JOIN folder AS drafts ON drafts.account = account.id AND drafts.type = '" + EntityFolder.DRAFTS + "'" + " WHERE :all OR account.synchronize" + diff --git a/app/src/main/java/eu/faircode/email/TupleAccountEx.java b/app/src/main/java/eu/faircode/email/TupleAccountEx.java index 5649c68711..7708fa9747 100644 --- a/app/src/main/java/eu/faircode/email/TupleAccountEx.java +++ b/app/src/main/java/eu/faircode/email/TupleAccountEx.java @@ -19,10 +19,12 @@ package eu.faircode.email; Copyright 2018-2020 by Marcel Bokhorst (M66B) */ +import java.util.Objects; + public class TupleAccountEx extends EntityAccount { public int unseen; public int identities; // synchronizing - public boolean drafts; + public Long drafts; @Override public boolean equals(Object obj) { @@ -31,7 +33,7 @@ public class TupleAccountEx extends EntityAccount { return (super.equals(obj) && this.unseen == other.unseen && this.identities == other.identities && - this.drafts == other.drafts); + Objects.equals(this.drafts, other.drafts)); } else return false; }