mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-28 04:25:18 +00:00
For # too.
This commit is contained in:
parent
68234959c4
commit
40ca2575da
@ -54,18 +54,24 @@ public class ContactPhotoFactory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static Drawable getDefaultContactPhoto(Context context, @Nullable String name) {
|
public static Drawable getDefaultContactPhoto(Context context, @Nullable String name) {
|
||||||
|
int targetSize = context.getResources().getDimensionPixelSize(R.dimen.contact_photo_target_size);
|
||||||
|
|
||||||
if (name != null && !name.isEmpty()) {
|
if (name != null && !name.isEmpty()) {
|
||||||
int targetSize = context.getResources().getDimensionPixelSize(R.dimen.contact_photo_target_size);
|
|
||||||
return TextDrawable.builder().beginConfig()
|
return TextDrawable.builder().beginConfig()
|
||||||
.width(targetSize)
|
.width(targetSize)
|
||||||
.height(targetSize)
|
.height(targetSize)
|
||||||
.endConfig().buildRound(String.valueOf(name.charAt(0)),
|
.endConfig()
|
||||||
|
.buildRound(String.valueOf(name.charAt(0)),
|
||||||
COLOR_GENERATOR.getColor(name));
|
COLOR_GENERATOR.getColor(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
synchronized (defaultPhotoLock) {
|
synchronized (defaultPhotoLock) {
|
||||||
if (defaultContactPhoto == null)
|
if (defaultContactPhoto == null)
|
||||||
defaultContactPhoto = TextDrawable.builder().buildRound("#", UNKNOWN_COLOR);
|
defaultContactPhoto = TextDrawable.builder().beginConfig()
|
||||||
|
.width(targetSize)
|
||||||
|
.height(targetSize)
|
||||||
|
.endConfig()
|
||||||
|
.buildRound("#", UNKNOWN_COLOR);
|
||||||
|
|
||||||
return defaultContactPhoto;
|
return defaultContactPhoto;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user