From 3b5c5f9dad79d8de65e58820d5b985d8d5ab4130 Mon Sep 17 00:00:00 2001 From: M66B Date: Wed, 30 Jan 2019 08:06:10 +0000 Subject: [PATCH] Fixed contact info caching --- app/src/main/java/eu/faircode/email/ContactInfo.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/ContactInfo.java b/app/src/main/java/eu/faircode/email/ContactInfo.java index 66c4efcc86..abd83da16f 100644 --- a/app/src/main/java/eu/faircode/email/ContactInfo.java +++ b/app/src/main/java/eu/faircode/email/ContactInfo.java @@ -76,9 +76,9 @@ public class ContactInfo { return new ContactInfo(); InternetAddress address = (InternetAddress) addresses[0]; - String email = address.getAddress(); + String key = address.toString(); synchronized (emailContactInfo) { - ContactInfo info = emailContactInfo.get(email); + ContactInfo info = emailContactInfo.get(key); if (info != null && !info.isExpired()) return info; } @@ -87,7 +87,7 @@ public class ContactInfo { return null; ContactInfo info = new ContactInfo(); - info.email = email; + info.email = address.getAddress(); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); @@ -105,7 +105,7 @@ public class ContactInfo { }, ContactsContract.CommonDataKinds.Email.ADDRESS + " = ?", new String[]{ - email + address.getAddress() }, null); if (cursor != null && cursor.moveToNext()) { @@ -139,7 +139,7 @@ public class ContactInfo { if (identicons) { String theme = prefs.getString("theme", "light"); int dp = Helper.dp2pixels(context, 48); - info.bitmap = Identicon.generate(email, dp, 5, "light".equals(theme)); + info.bitmap = Identicon.generate(key, dp, 5, "light".equals(theme)); } } @@ -147,7 +147,7 @@ public class ContactInfo { info.displayName = address.getPersonal(); synchronized (emailContactInfo) { - emailContactInfo.put(email, info); + emailContactInfo.put(key, info); } info.time = new Date().getTime();