Simplification/fix

This commit is contained in:
M66B 2019-10-11 10:06:26 +02:00
parent 975a5e6bd3
commit a0fd45dab6
1 changed files with 8 additions and 14 deletions

View File

@ -670,14 +670,13 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
boolean inbox = EntityFolder.INBOX.equals(message.folderType); boolean inbox = EntityFolder.INBOX.equals(message.folderType);
boolean outbox = EntityFolder.OUTBOX.equals(message.folderType); boolean outbox = EntityFolder.OUTBOX.equals(message.folderType);
boolean outgoing = isOutgoing(message); boolean outgoing = isOutgoing(message);
Address[] addresses = (outgoing ? message.to : message.senders); Address[] addresses = (outgoing && viewType != ViewType.THREAD ? message.to : message.senders);
boolean expanded = (viewType == ViewType.THREAD && properties.getValue("expanded", message.id)); boolean expanded = (viewType == ViewType.THREAD && properties.getValue("expanded", message.id));
if (viewType == ViewType.THREAD) { if (viewType == ViewType.THREAD) {
ivAvatarStart.setVisibility(outgoing && bubble ? View.INVISIBLE : View.GONE); ivAvatarStart.setVisibility(outgoing && bubble ? View.INVISIBLE : View.GONE);
ivAvatarEnd.setVisibility(outgoing || !bubble ? View.GONE : View.INVISIBLE); ivAvatarEnd.setVisibility(outgoing || !bubble ? View.GONE : View.INVISIBLE);
ivAvatar.setVisibility(bubble || !avatars ? View.GONE : View.INVISIBLE); ivAvatar.setVisibility(bubble || !avatars ? View.GONE : View.INVISIBLE);
outgoing = false;
} else { } else {
ivAvatarStart.setVisibility(View.GONE); ivAvatarStart.setVisibility(View.GONE);
ivAvatarEnd.setVisibility(View.GONE); ivAvatarEnd.setVisibility(View.GONE);
@ -797,18 +796,13 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
Boolean.FALSE.equals(message.mx)); Boolean.FALSE.equals(message.mx));
// Line 3 // Line 3
int icon; int icon = (message.drafts > 0
if (outgoing && !EntityFolder.SENT.equals(message.folderType)) { ? R.drawable.baseline_edit_24
icon = EntityFolder.getIcon(EntityFolder.SENT); : EntityFolder.getIcon(outgoing ? EntityFolder.SENT : message.folderType));
ivType.setVisibility(View.VISIBLE); ivType.setVisibility(message.drafts > 0 ||
} else { (viewType == ViewType.UNIFIED && type == null && !inbox) ||
icon = (message.drafts > 0 (viewType == ViewType.THREAD && (outgoing || EntityFolder.SENT.equals(message.folderType)))
? R.drawable.baseline_edit_24 : EntityFolder.getIcon(message.folderType)); ? View.VISIBLE : View.GONE);
ivType.setVisibility(message.drafts > 0 ||
(viewType == ViewType.UNIFIED && type == null && !inbox) ||
(viewType == ViewType.THREAD && EntityFolder.SENT.equals(message.folderType))
? View.VISIBLE : View.GONE);
}
if (ivType.getTag() == null || (int) ivType.getTag() != icon) { if (ivType.getTag() == null || (int) ivType.getTag() != icon) {
ivType.setTag(icon); ivType.setTag(icon);
ivType.setImageResource(icon); ivType.setImageResource(icon);