Refactoring

pull/184/head
M66B 5 years ago
parent 24b6da0598
commit 9be5a82e0e

@ -202,7 +202,7 @@ public class AdapterAccount extends RecyclerView.Adapter<AdapterAccount.ViewHold
tvMaxSize.setVisibility(account.max_size != null && BuildConfig.DEBUG ? View.VISIBLE : View.GONE); tvMaxSize.setVisibility(account.max_size != null && BuildConfig.DEBUG ? View.VISIBLE : View.GONE);
tvIdentity.setVisibility(account.identities > 0 || !settings ? View.GONE : View.VISIBLE); tvIdentity.setVisibility(account.identities > 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.setText(account.warning);
tvWarning.setVisibility(account.warning == null || !settings ? View.GONE : View.VISIBLE); tvWarning.setVisibility(account.warning == null || !settings ? View.GONE : View.VISIBLE);

@ -63,7 +63,7 @@ public interface DaoAccount {
" FROM identity" + " FROM identity" +
" WHERE identity.account = account.id" + " WHERE identity.account = account.id" +
" AND identity.synchronize) AS identities" + " AND identity.synchronize) AS identities" +
", CASE WHEN drafts.id IS NULL THEN 0 ELSE 1 END AS drafts" + ", drafts.id AS drafts" +
" FROM account" + " FROM account" +
" LEFT JOIN folder AS drafts ON drafts.account = account.id AND drafts.type = '" + EntityFolder.DRAFTS + "'" + " LEFT JOIN folder AS drafts ON drafts.account = account.id AND drafts.type = '" + EntityFolder.DRAFTS + "'" +
" WHERE :all OR account.synchronize" + " WHERE :all OR account.synchronize" +

@ -19,10 +19,12 @@ package eu.faircode.email;
Copyright 2018-2020 by Marcel Bokhorst (M66B) Copyright 2018-2020 by Marcel Bokhorst (M66B)
*/ */
import java.util.Objects;
public class TupleAccountEx extends EntityAccount { public class TupleAccountEx extends EntityAccount {
public int unseen; public int unseen;
public int identities; // synchronizing public int identities; // synchronizing
public boolean drafts; public Long drafts;
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
@ -31,7 +33,7 @@ public class TupleAccountEx extends EntityAccount {
return (super.equals(obj) && return (super.equals(obj) &&
this.unseen == other.unseen && this.unseen == other.unseen &&
this.identities == other.identities && this.identities == other.identities &&
this.drafts == other.drafts); Objects.equals(this.drafts, other.drafts));
} else } else
return false; return false;
} }

Loading…
Cancel
Save