Show colored background on collapsed only

This commit is contained in:
M66B 2019-09-29 11:14:50 +02:00
parent 89a0b9df42
commit fa2af15369
1 changed files with 15 additions and 14 deletions

View File

@ -792,7 +792,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
} }
// Starred // Starred
bindFlagged(message); bindFlagged(message, expanded);
// Message text preview // Message text preview
tvPreview.setTextColor(contrast ? textColorPrimary : textColorSecondary); tvPreview.setTextColor(contrast ? textColorPrimary : textColorSecondary);
@ -952,7 +952,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
tvNoInternetBody.setVisibility(View.GONE); tvNoInternetBody.setVisibility(View.GONE);
} }
private void bindFlagged(TupleMessageEx message) { private void bindFlagged(TupleMessageEx message, boolean expanded) {
boolean pro = ActivityBilling.isPro(context); boolean pro = ActivityBilling.isPro(context);
if (!pro) if (!pro)
message.color = null; message.color = null;
@ -960,18 +960,15 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
int flagged = (message.count - message.unflagged); int flagged = (message.count - message.unflagged);
ibFlagged.setImageResource(flagged > 0 ? R.drawable.baseline_star_24 : R.drawable.baseline_star_border_24); ibFlagged.setImageResource(flagged > 0 ? R.drawable.baseline_star_24 : R.drawable.baseline_star_border_24);
if (flags_background) { if (message.color == null || expanded || !flags_background)
if (message.color == null)
card.setCardBackgroundColor(Color.TRANSPARENT);
else
card.setCardBackgroundColor(ColorUtils.setAlphaComponent(message.color, 127));
} else {
card.setCardBackgroundColor(Color.TRANSPARENT); card.setCardBackgroundColor(Color.TRANSPARENT);
if (message.color == null) else
ibFlagged.setImageTintList(ColorStateList.valueOf(flagged > 0 ? colorAccent : textColorSecondary)); card.setCardBackgroundColor(ColorUtils.setAlphaComponent(message.color, 127));
else
ibFlagged.setImageTintList(ColorStateList.valueOf(message.color)); if (message.color == null)
} ibFlagged.setImageTintList(ColorStateList.valueOf(flagged > 0 ? colorAccent : textColorSecondary));
else
ibFlagged.setImageTintList(ColorStateList.valueOf(expanded ? message.color : textColorSecondary));
ibFlagged.setEnabled(message.uid != null || message.accountPop); ibFlagged.setEnabled(message.uid != null || message.accountPop);
@ -1781,7 +1778,9 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
message.unflagged = message.ui_flagged ? message.count : 0; message.unflagged = message.ui_flagged ? message.count : 0;
message.ui_flagged = !message.ui_flagged; message.ui_flagged = !message.ui_flagged;
bindFlagged(message);
boolean expanded = properties.getValue("expanded", message.id);
bindFlagged(message, expanded);
new SimpleTask<Void>() { new SimpleTask<Void>() {
@Override @Override
@ -2024,6 +2023,8 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
bindExpanded(message, true); bindExpanded(message, true);
else else
clearExpanded(message); clearExpanded(message);
bindFlagged(message, expanded);
} }
} }