mirror of
https://github.com/M66B/FairEmail.git
synced 2025-03-03 18:26:20 +00:00
Show avatar of recipient for outgoing messages
This commit is contained in:
parent
bce3ed511b
commit
6b4b0e280e
1 changed files with 15 additions and 29 deletions
|
@ -915,9 +915,12 @@ 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);
|
||||||
boolean reverse = (!show_recipients && outgoing && (viewType != ViewType.THREAD || !threading));
|
boolean reverse = (outgoing && (viewType != ViewType.THREAD || !threading));
|
||||||
Address[] senders = ContactInfo.fillIn(reverse ? message.to : message.senders, prefer_contact);
|
Address[] addresses = (reverse ? message.to : message.from);
|
||||||
Address[] recipients = ContactInfo.fillIn(reverse ? message.from : message.recipients, prefer_contact);
|
Address[] senders = ContactInfo.fillIn(
|
||||||
|
reverse && !show_recipients ? message.to : message.senders, prefer_contact);
|
||||||
|
Address[] recipients = ContactInfo.fillIn(
|
||||||
|
reverse && !show_recipients ? message.from : message.recipients, prefer_contact);
|
||||||
boolean authenticated =
|
boolean authenticated =
|
||||||
!(Boolean.FALSE.equals(message.dkim) ||
|
!(Boolean.FALSE.equals(message.dkim) ||
|
||||||
Boolean.FALSE.equals(message.spf) ||
|
Boolean.FALSE.equals(message.spf) ||
|
||||||
|
@ -1175,12 +1178,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||||
}
|
}
|
||||||
|
|
||||||
// Contact info
|
// Contact info
|
||||||
List<Address> all = new ArrayList<>();
|
ContactInfo[] info = ContactInfo.getCached(context, message.account, message.folderType, addresses);
|
||||||
if (senders != null)
|
|
||||||
all.addAll(Arrays.asList(senders));
|
|
||||||
if (show_recipients && recipients != null)
|
|
||||||
all.addAll(Arrays.asList(recipients));
|
|
||||||
ContactInfo[] info = ContactInfo.getCached(context, message.account, message.folderType, all.toArray(new Address[0]));
|
|
||||||
if (info == null) {
|
if (info == null) {
|
||||||
if (taskContactInfo != null)
|
if (taskContactInfo != null)
|
||||||
taskContactInfo.cancel(context);
|
taskContactInfo.cancel(context);
|
||||||
|
@ -1189,27 +1187,15 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||||
aargs.putLong("id", message.id);
|
aargs.putLong("id", message.id);
|
||||||
aargs.putLong("account", message.account);
|
aargs.putLong("account", message.account);
|
||||||
aargs.putString("folderType", message.folderType);
|
aargs.putString("folderType", message.folderType);
|
||||||
aargs.putSerializable("senders", senders);
|
aargs.putSerializable("addresses", addresses);
|
||||||
aargs.putSerializable("recipients", show_recipients ? recipients : null);
|
|
||||||
|
|
||||||
taskContactInfo = new SimpleTask<ContactInfo[]>() {
|
taskContactInfo = new SimpleTask<ContactInfo[]>() {
|
||||||
@Override
|
@Override
|
||||||
protected ContactInfo[] onExecute(Context context, Bundle args) {
|
protected ContactInfo[] onExecute(Context context, Bundle args) {
|
||||||
long account = args.getLong("account");
|
long account = args.getLong("account");
|
||||||
String folderType = args.getString("folderType");
|
String folderType = args.getString("folderType");
|
||||||
Address[] senders = (Address[]) args.getSerializable("senders");
|
Address[] addresses = (Address[]) args.getSerializable("addresses");
|
||||||
Address[] recipients = (Address[]) args.getSerializable("recipients");
|
return ContactInfo.get(context, account, folderType, addresses);
|
||||||
|
|
||||||
if (senders == null)
|
|
||||||
senders = new Address[0];
|
|
||||||
if (recipients == null)
|
|
||||||
recipients = new Address[0];
|
|
||||||
|
|
||||||
Address[] all = new Address[senders.length + recipients.length];
|
|
||||||
System.arraycopy(senders, 0, all, 0, senders.length);
|
|
||||||
System.arraycopy(recipients, 0, all, senders.length, recipients.length);
|
|
||||||
|
|
||||||
return ContactInfo.get(context, account, folderType, all);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1221,7 +1207,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||||
if (amessage == null || !amessage.id.equals(id))
|
if (amessage == null || !amessage.id.equals(id))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
bindContactInfo(amessage, info, senders, recipients);
|
bindContactInfo(amessage, info, addresses);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1231,7 +1217,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||||
}.setLog(false);
|
}.setLog(false);
|
||||||
taskContactInfo.execute(context, owner, aargs, "message:avatar");
|
taskContactInfo.execute(context, owner, aargs, "message:avatar");
|
||||||
} else
|
} else
|
||||||
bindContactInfo(message, info, senders, show_recipients ? recipients : null);
|
bindContactInfo(message, info, addresses);
|
||||||
|
|
||||||
if (viewType == ViewType.THREAD)
|
if (viewType == ViewType.THREAD)
|
||||||
if (expanded)
|
if (expanded)
|
||||||
|
@ -1457,7 +1443,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||||
ibFlagged.setVisibility(View.GONE);
|
ibFlagged.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void bindContactInfo(TupleMessageEx message, ContactInfo[] info, Address[] senders, Address[] recipients) {
|
private void bindContactInfo(TupleMessageEx message, ContactInfo[] info, Address[] addresses) {
|
||||||
if (avatars) {
|
if (avatars) {
|
||||||
ContactInfo main = (info.length > 0 ? info[0] : null);
|
ContactInfo main = (info.length > 0 ? info[0] : null);
|
||||||
if (main == null || !main.hasPhoto()) {
|
if (main == null || !main.hasPhoto()) {
|
||||||
|
@ -1475,8 +1461,8 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||||
|
|
||||||
if (distinguish_contacts) {
|
if (distinguish_contacts) {
|
||||||
boolean known = false;
|
boolean known = false;
|
||||||
if (senders != null)
|
if (addresses != null)
|
||||||
for (int i = 0; i < senders.length; i++)
|
for (int i = 0; i < addresses.length; i++)
|
||||||
if (info[i].isKnown()) {
|
if (info[i].isKnown()) {
|
||||||
known = true;
|
known = true;
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue