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))
|
is MatrixItem.UserItem -> ContextCompat.getColor(context, getColorFromUserId(matrixItem.id))
|
||||||
else -> ContextCompat.getColor(context, getColorFromRoomId(matrixItem.id))
|
else -> ContextCompat.getColor(context, getColorFromRoomId(matrixItem.id))
|
||||||
}
|
}
|
||||||
return if (matrixItem.displayName.isNullOrBlank()) {
|
return TextDrawable.builder()
|
||||||
TextDrawable.builder().buildRound("", avatarColor)
|
.beginConfig()
|
||||||
} else {
|
.bold()
|
||||||
val firstLetter = matrixItem.firstLetterOfDisplayName()
|
.endConfig()
|
||||||
TextDrawable.builder()
|
.buildRound(matrixItem.firstLetterOfDisplayName(), avatarColor)
|
||||||
.beginConfig()
|
|
||||||
.bold()
|
|
||||||
.endConfig()
|
|
||||||
.buildRound(firstLetter, avatarColor)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// PRIVATE API *********************************************************************************
|
// PRIVATE API *********************************************************************************
|
||||||
|
|
Loading…
Reference in New Issue