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 // Content
Row { Row {
Avatar(senderAvatar, avatarColors = avatarColors) Avatar(senderAvatar, initialAvatarColors = avatarColors)
Spacer(modifier = Modifier.width(4.dp)) Spacer(modifier = Modifier.width(4.dp))
Text( Text(
text = sender, text = sender,

View file

@ -46,7 +46,7 @@ import timber.log.Timber
fun Avatar( fun Avatar(
avatarData: AvatarData, avatarData: AvatarData,
modifier: Modifier = Modifier, modifier: Modifier = Modifier,
avatarColors: AvatarColors? = null, initialAvatarColors: AvatarColors? = null,
contentDescription: String? = null, contentDescription: String? = null,
) { ) {
val commonModifier = modifier val commonModifier = modifier
@ -55,7 +55,7 @@ fun Avatar(
if (avatarData.url.isNullOrBlank()) { if (avatarData.url.isNullOrBlank()) {
InitialsAvatar( InitialsAvatar(
avatarData = avatarData, avatarData = avatarData,
avatarColors = avatarColors, avatarColors = initialAvatarColors,
modifier = commonModifier, modifier = commonModifier,
) )
} else { } else {
@ -91,7 +91,7 @@ private fun InitialsAvatar(
avatarColors: AvatarColors?, avatarColors: AvatarColors?,
modifier: Modifier = Modifier, 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 val avatarColor = ElementTheme.colors.bgActionPrimaryDisabled
Box( Box(
modifier.background(color = avatarColors?.background ?: avatarColor) modifier.background(color = avatarColors?.background ?: avatarColor)

View file

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