Display first letter of id if display name is empty
This commit is contained in:
parent
cecef5b8da
commit
0a0eda3e34
|
@ -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()
|
||||
return TextDrawable.builder()
|
||||
.beginConfig()
|
||||
.bold()
|
||||
.endConfig()
|
||||
.buildRound(firstLetter, avatarColor)
|
||||
}
|
||||
.buildRound(matrixItem.firstLetterOfDisplayName(), avatarColor)
|
||||
}
|
||||
|
||||
// PRIVATE API *********************************************************************************
|
||||
|
|
Loading…
Reference in New Issue