Experiment: use shadow for selected messages

pull/194/merge
M66B 3 years ago
parent e7d43f7079
commit 43c2d0fe6a

@ -1626,19 +1626,25 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
} }
private void bindSeen(TupleMessageEx message) { private void bindSeen(TupleMessageEx message) {
if (cards && shadow_unread) { if (cards) {
boolean shadow = (message.unseen > 0); boolean unseen = (shadow_unread && message.unseen > 0);
int color = (shadow boolean selected = properties.getValue("selected", message.id);
? ColorUtils.setAlphaComponent(shadow_highlight ? colorUnreadHighlight : colorAccent, 127)
: Color.TRANSPARENT); int color;
if (!Objects.equals(itemView.getTag(), shadow)) { if (unseen)
itemView.setTag(shadow); color = ColorUtils.setAlphaComponent(shadow_highlight ? colorUnreadHighlight : colorAccent, 127);
else if (selected)
color = ColorUtils.setAlphaComponent(colorSeparator, 127);
else
color = Color.TRANSPARENT;
if (!Objects.equals(itemView.getTag(), color)) {
itemView.setTag(color);
itemView.setBackgroundColor(color); itemView.setBackgroundColor(color);
ViewGroup.MarginLayoutParams lparam = (ViewGroup.MarginLayoutParams) itemView.getLayoutParams(); ViewGroup.MarginLayoutParams lparam = (ViewGroup.MarginLayoutParams) itemView.getLayoutParams();
lparam.topMargin = (shadow ? dp1 : 0); lparam.topMargin = (unseen || selected ? dp1 : 0);
lparam.bottomMargin = (shadow ? dp1 : 0); lparam.bottomMargin = (unseen || selected ? dp1 : 0);
itemView.setLayoutParams(lparam); itemView.setLayoutParams(lparam);
} }
} }

Loading…
Cancel
Save