From 48d0a13229a768eb50c1582084c5ee84c9ebcf45 Mon Sep 17 00:00:00 2001 From: M66B Date: Sun, 9 Feb 2020 12:14:11 +0100 Subject: [PATCH] Resolve all contact info --- .../eu/faircode/email/AdapterMessage.java | 53 +++++++++++-------- .../java/eu/faircode/email/ContactInfo.java | 26 +++++++-- app/src/main/java/eu/faircode/email/Core.java | 20 +++---- 3 files changed, 63 insertions(+), 36 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/AdapterMessage.java b/app/src/main/java/eu/faircode/email/AdapterMessage.java index 8692d10619..c3e30142b1 100644 --- a/app/src/main/java/eu/faircode/email/AdapterMessage.java +++ b/app/src/main/java/eu/faircode/email/AdapterMessage.java @@ -1036,7 +1036,7 @@ public class AdapterMessage extends RecyclerView.Adapter() { + taskContactInfo = new SimpleTask() { @Override - protected ContactInfo onExecute(Context context, Bundle args) { + protected ContactInfo[] onExecute(Context context, Bundle args) { long account = args.getLong("account"); Address[] addresses = (Address[]) args.getSerializable("addresses"); - return ContactInfo.get(context, account, addresses, false); + return ContactInfo.get(context, account, addresses); } @Override - protected void onExecuted(Bundle args, ContactInfo info) { + protected void onExecuted(Bundle args, ContactInfo[] info) { taskContactInfo = null; long id = args.getLong("id"); @@ -1207,33 +1207,40 @@ public class AdapterMessage extends RecyclerView.Adapter messageContact = new HashMap<>(); + Map messageContact = new HashMap<>(); for (TupleMessageEx message : messages) - messageContact.put(message.id, ContactInfo.get(context, message.account, message.from, false)); + messageContact.put(message.id, ContactInfo.get(context, message.account, message.from)); // Summary notification if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N || notify_summary) { @@ -2939,8 +2939,8 @@ class Core { DateFormat DTF = Helper.getDateTimeInstance(context, SimpleDateFormat.SHORT, SimpleDateFormat.SHORT); StringBuilder sb = new StringBuilder(); for (EntityMessage message : messages) { - ContactInfo info = messageContact.get(message.id); - sb.append("").append(info.getDisplayName(name_email)).append(""); + ContactInfo[] info = messageContact.get(message.id); + sb.append("").append(info[0].getDisplayName(name_email)).append(""); if (!TextUtils.isEmpty(message.subject)) sb.append(": ").append(message.subject); sb.append(" ").append(DTF.format(message.received)); @@ -2964,7 +2964,7 @@ class Core { // Message notifications for (TupleMessageEx message : messages) { - ContactInfo info = messageContact.get(message.id); + ContactInfo[] info = messageContact.get(message.id); // Build arguments long id = (message.content ? message.id : -message.id); @@ -3031,7 +3031,7 @@ class Core { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) setLightAndSound(mbuilder, light, sound); - mbuilder.setContentTitle(info.getDisplayName(name_email)) + mbuilder.setContentTitle(info[0].getDisplayName(name_email)) .setSubText(message.accountName + " ยท " + message.getFolderName(context)); DB db = DB.getInstance(context); @@ -3239,11 +3239,11 @@ class Core { mbuilder.setContentText(message.subject); } - if (info.hasPhoto()) - mbuilder.setLargeIcon(info.getPhotoBitmap()); + if (info[0].hasPhoto()) + mbuilder.setLargeIcon(info[0].getPhotoBitmap()); - if (info.hasLookupUri()) - mbuilder.addPerson(info.getLookupUri().toString()); + if (info[0].hasLookupUri()) + mbuilder.addPerson(info[0].getLookupUri().toString()); if (pro && message.accountColor != null) { mbuilder.setColor(message.accountColor);