From 0a0eda3e342d2858cb4ce695deb8e65af58512de Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Mon, 16 Dec 2019 11:08:48 +0100 Subject: [PATCH] Display first letter of id if display name is empty --- .../vector/riotx/features/home/AvatarRenderer.kt | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/vector/src/main/java/im/vector/riotx/features/home/AvatarRenderer.kt b/vector/src/main/java/im/vector/riotx/features/home/AvatarRenderer.kt index ae02ce6519..4e1808a48a 100644 --- a/vector/src/main/java/im/vector/riotx/features/home/AvatarRenderer.kt +++ b/vector/src/main/java/im/vector/riotx/features/home/AvatarRenderer.kt @@ -69,16 +69,11 @@ class AvatarRenderer @Inject constructor(private val activeSessionHolder: Active is MatrixItem.UserItem -> ContextCompat.getColor(context, getColorFromUserId(matrixItem.id)) else -> ContextCompat.getColor(context, getColorFromRoomId(matrixItem.id)) } - return if (matrixItem.displayName.isNullOrBlank()) { - TextDrawable.builder().buildRound("", avatarColor) - } else { - val firstLetter = matrixItem.firstLetterOfDisplayName() - TextDrawable.builder() - .beginConfig() - .bold() - .endConfig() - .buildRound(firstLetter, avatarColor) - } + return TextDrawable.builder() + .beginConfig() + .bold() + .endConfig() + .buildRound(matrixItem.firstLetterOfDisplayName(), avatarColor) } // PRIVATE API *********************************************************************************