diff --git a/app/src/main/java/eu/faircode/email/AdapterIdentity.java b/app/src/main/java/eu/faircode/email/AdapterIdentity.java index ad7f583845..0821dcf69c 100644 --- a/app/src/main/java/eu/faircode/email/AdapterIdentity.java +++ b/app/src/main/java/eu/faircode/email/AdapterIdentity.java @@ -133,7 +133,8 @@ public class AdapterIdentity extends RecyclerView.Adapter { this.identities = identities; for (TupleIdentityEx identity : identities) - if (identity.color != null) { + if (identity.color != null || identity.accountColor != null) { hasColor = true; break; } @@ -71,7 +71,8 @@ public class AdapterIdentitySelect extends ArrayAdapter { TextView tvExtra1 = view.findViewById(R.id.tvExtra1); TextView tvExtra2 = view.findViewById(R.id.tvExtra2); - vwColor.setBackgroundColor(identity.color == null ? Color.TRANSPARENT : identity.color); + Integer color = (identity.color == null ? identity.accountColor : identity.color); + vwColor.setBackgroundColor(color == null ? Color.TRANSPARENT : color); vwColor.setVisibility(hasColor ? View.VISIBLE : View.GONE); boolean single = (identities.size() == 1 && identity.cc == null && identity.bcc == null); diff --git a/app/src/main/java/eu/faircode/email/DaoIdentity.java b/app/src/main/java/eu/faircode/email/DaoIdentity.java index 55b55420a6..9e15bb9518 100644 --- a/app/src/main/java/eu/faircode/email/DaoIdentity.java +++ b/app/src/main/java/eu/faircode/email/DaoIdentity.java @@ -33,7 +33,7 @@ public interface DaoIdentity { LiveData> liveIdentityView(); @Query("SELECT identity.*" + - ", account.name AS accountName, account.category AS accountCategory, account.synchronize AS accountSynchronize" + + ", account.name AS accountName, account.category AS accountCategory, account.color AS accountColor, account.synchronize AS accountSynchronize" + ", folder.id AS drafts" + " FROM identity" + " JOIN account ON account.id = identity.account" + @@ -41,7 +41,7 @@ public interface DaoIdentity { LiveData> liveIdentities(); @Query("SELECT identity.*" + - ", account.name AS accountName, account.category AS accountCategory, account.synchronize AS accountSynchronize" + + ", account.name AS accountName, account.category AS accountCategory, account.color AS accountColor, account.synchronize AS accountSynchronize" + ", folder.id AS drafts" + " FROM identity" + " JOIN account ON account.id = identity.account" + @@ -51,7 +51,7 @@ public interface DaoIdentity { LiveData> liveComposableIdentities(); @Query("SELECT identity.*" + - ", account.name AS accountName, account.category AS accountCategory, account.synchronize AS accountSynchronize" + + ", account.name AS accountName, account.category AS accountCategory, account.color AS accountColor, account.synchronize AS accountSynchronize" + ", folder.id AS drafts" + " FROM identity" + " JOIN account ON account.id = identity.account" + diff --git a/app/src/main/java/eu/faircode/email/FragmentDialogSelectIdentity.java b/app/src/main/java/eu/faircode/email/FragmentDialogSelectIdentity.java index 307a7a2f49..466b3134c9 100644 --- a/app/src/main/java/eu/faircode/email/FragmentDialogSelectIdentity.java +++ b/app/src/main/java/eu/faircode/email/FragmentDialogSelectIdentity.java @@ -59,7 +59,8 @@ public class FragmentDialogSelectIdentity extends FragmentDialogBase { int vpad = (getCount() > 10 ? dp6 : dp12); tv.setPadding(0, vpad, 0, vpad); - vwColor.setBackgroundColor(identity.color == null ? Color.TRANSPARENT : identity.color); + Integer color = (identity.color == null ? identity.accountColor : identity.color); + vwColor.setBackgroundColor(color == null ? Color.TRANSPARENT : color); tv.setText(identity.getDisplayName()); return view; diff --git a/app/src/main/java/eu/faircode/email/TupleIdentityEx.java b/app/src/main/java/eu/faircode/email/TupleIdentityEx.java index 9daf450fb0..f8d8e66706 100644 --- a/app/src/main/java/eu/faircode/email/TupleIdentityEx.java +++ b/app/src/main/java/eu/faircode/email/TupleIdentityEx.java @@ -24,6 +24,7 @@ import java.util.Objects; public class TupleIdentityEx extends EntityIdentity { public String accountName; public String accountCategory; + public Integer accountColor; public boolean accountSynchronize; public Long drafts; @@ -34,6 +35,7 @@ public class TupleIdentityEx extends EntityIdentity { return (super.equals(obj) && Objects.equals(this.accountCategory, other.accountCategory) && Objects.equals(this.accountName, other.accountName) && + Objects.equals(this.accountColor, other.accountColor) && this.accountSynchronize == other.accountSynchronize && Objects.equals(this.drafts, other.drafts)); } else