Rename parameter and update comment.

This commit is contained in:
Benoit Marty
2023-09-05 15:45:12 +02:00
parent fcc89bbb4f
commit 3168775446
3 changed files with 5 additions and 5 deletions

View File

@@ -346,7 +346,7 @@ private fun MessageSenderInformation(
}
// Content
Row {
Avatar(senderAvatar, avatarColors = avatarColors)
Avatar(senderAvatar, initialAvatarColors = avatarColors)
Spacer(modifier = Modifier.width(4.dp))
Text(
text = sender,

View File

@@ -46,7 +46,7 @@ import timber.log.Timber
fun Avatar(
avatarData: AvatarData,
modifier: Modifier = Modifier,
avatarColors: AvatarColors? = null,
initialAvatarColors: AvatarColors? = null,
contentDescription: String? = null,
) {
val commonModifier = modifier
@@ -55,7 +55,7 @@ fun Avatar(
if (avatarData.url.isNullOrBlank()) {
InitialsAvatar(
avatarData = avatarData,
avatarColors = avatarColors,
avatarColors = initialAvatarColors,
modifier = commonModifier,
)
} else {
@@ -91,7 +91,7 @@ private fun InitialsAvatar(
avatarColors: AvatarColors?,
modifier: Modifier = Modifier,
) {
// Use temporary color for default avatar background
// Use temporary color for default avatar background, if avatarColors is not provided
val avatarColor = ElementTheme.colors.bgActionPrimaryDisabled
Box(
modifier.background(color = avatarColors?.background ?: avatarColor)

View File

@@ -43,7 +43,7 @@ internal fun UserAvatarPreview() = ElementPreview {
verticalAlignment = Alignment.CenterVertically,
) {
// Note: it's OK, since the hash of "0" is 0, the hash of "1" is 1, etc.
Avatar(anAvatarData(), avatarColors = avatarColors("$it"))
Avatar(anAvatarData(), initialAvatarColors = avatarColors("$it"))
Text(text = "Color index $it")
}
}