diff --git a/src/org/thoughtcrime/securesms/contacts/ContactPhotoFactory.java b/src/org/thoughtcrime/securesms/contacts/ContactPhotoFactory.java index 7242c58ef8..249e79dc68 100644 --- a/src/org/thoughtcrime/securesms/contacts/ContactPhotoFactory.java +++ b/src/org/thoughtcrime/securesms/contacts/ContactPhotoFactory.java @@ -18,9 +18,12 @@ import java.util.Map; public class ContactPhotoFactory { - private static final Object defaultPhotoLock = new Object(); + private static final Object defaultPhotoLock = new Object(); + private static final Object defaultGroupPhotoLock = new Object(); private static Bitmap defaultContactPhoto; + private static Bitmap defaultGroupContactPhoto; + private static final Map localUserContactPhotoCache = Collections.synchronizedMap(new LRUCache(2)); @@ -40,11 +43,11 @@ public class ContactPhotoFactory { } public static Bitmap getDefaultGroupPhoto(Context context) { - synchronized (defaultPhotoLock) { - if (defaultContactPhoto == null) - defaultContactPhoto = BitmapFactory.decodeResource(context.getResources(), - R.drawable.ic_group_photo); - return defaultContactPhoto; + synchronized (defaultGroupPhotoLock) { + if (defaultGroupContactPhoto == null) + defaultGroupContactPhoto = BitmapFactory.decodeResource(context.getResources(), + R.drawable.ic_group_photo); + return defaultGroupContactPhoto; } } diff --git a/src/org/thoughtcrime/securesms/recipients/RecipientProvider.java b/src/org/thoughtcrime/securesms/recipients/RecipientProvider.java index 893214245d..cc1f89cc81 100644 --- a/src/org/thoughtcrime/securesms/recipients/RecipientProvider.java +++ b/src/org/thoughtcrime/securesms/recipients/RecipientProvider.java @@ -151,7 +151,7 @@ public class RecipientProvider { byte[] avatarBytes = record.getAvatar(); Bitmap avatar; - if (avatarBytes == null) avatar = ContactPhotoFactory.getDefaultContactPhoto(context); + if (avatarBytes == null) avatar = ContactPhotoFactory.getDefaultGroupPhoto(context); else avatar = BitmapFactory.decodeByteArray(avatarBytes, 0, avatarBytes.length); return new RecipientDetails(record.getTitle(), null, avatar);