mirror of
https://github.com/oxen-io/session-android.git
synced 2025-02-20 04:58:27 +00:00
Make default group avatar icon actually work.
This commit is contained in:
parent
ee921a8f49
commit
a2fe8a9d5c
@ -18,9 +18,12 @@ import java.util.Map;
|
|||||||
|
|
||||||
public class ContactPhotoFactory {
|
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 defaultContactPhoto;
|
||||||
|
private static Bitmap defaultGroupContactPhoto;
|
||||||
|
|
||||||
private static final Map<Uri,Bitmap> localUserContactPhotoCache =
|
private static final Map<Uri,Bitmap> localUserContactPhotoCache =
|
||||||
Collections.synchronizedMap(new LRUCache<Uri,Bitmap>(2));
|
Collections.synchronizedMap(new LRUCache<Uri,Bitmap>(2));
|
||||||
|
|
||||||
@ -40,11 +43,11 @@ public class ContactPhotoFactory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static Bitmap getDefaultGroupPhoto(Context context) {
|
public static Bitmap getDefaultGroupPhoto(Context context) {
|
||||||
synchronized (defaultPhotoLock) {
|
synchronized (defaultGroupPhotoLock) {
|
||||||
if (defaultContactPhoto == null)
|
if (defaultGroupContactPhoto == null)
|
||||||
defaultContactPhoto = BitmapFactory.decodeResource(context.getResources(),
|
defaultGroupContactPhoto = BitmapFactory.decodeResource(context.getResources(),
|
||||||
R.drawable.ic_group_photo);
|
R.drawable.ic_group_photo);
|
||||||
return defaultContactPhoto;
|
return defaultGroupContactPhoto;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -151,7 +151,7 @@ public class RecipientProvider {
|
|||||||
byte[] avatarBytes = record.getAvatar();
|
byte[] avatarBytes = record.getAvatar();
|
||||||
Bitmap avatar;
|
Bitmap avatar;
|
||||||
|
|
||||||
if (avatarBytes == null) avatar = ContactPhotoFactory.getDefaultContactPhoto(context);
|
if (avatarBytes == null) avatar = ContactPhotoFactory.getDefaultGroupPhoto(context);
|
||||||
else avatar = BitmapFactory.decodeByteArray(avatarBytes, 0, avatarBytes.length);
|
else avatar = BitmapFactory.decodeByteArray(avatarBytes, 0, avatarBytes.length);
|
||||||
|
|
||||||
return new RecipientDetails(record.getTitle(), null, avatar);
|
return new RecipientDetails(record.getTitle(), null, avatar);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user