Inherit identity color from account color

pull/213/head
M66B 1 year ago
parent 1d5f595cf5
commit 9ef14f399f

@ -133,7 +133,8 @@ public class AdapterIdentity extends RecyclerView.Adapter<AdapterIdentity.ViewHo
private void bindTo(TupleIdentityEx identity) {
view.setAlpha(identity.synchronize && identity.accountSynchronize ? 1.0f : Helper.LOW_LIGHT);
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(ActivityBilling.isPro(context) ? View.VISIBLE : View.INVISIBLE);
ivSync.setImageResource(identity.synchronize ? R.drawable.twotone_sync_24 : R.drawable.twotone_sync_disabled_24);

@ -43,7 +43,7 @@ public class AdapterIdentitySelect extends ArrayAdapter<TupleIdentityEx> {
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<TupleIdentityEx> {
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);

@ -33,7 +33,7 @@ public interface DaoIdentity {
LiveData<List<TupleIdentityView>> 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<List<TupleIdentityEx>> 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<List<TupleIdentityEx>> 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" +

@ -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;

@ -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

Loading…
Cancel
Save