Browse Source

Rename parameter and update comment.

pull/1224/head
Benoit Marty 1 year ago
parent
commit
6ef288c26d
  1. 2
      features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/components/TimelineItemEventRow.kt
  2. 6
      libraries/designsystem/src/main/kotlin/io/element/android/libraries/designsystem/components/avatar/Avatar.kt
  3. 2
      libraries/designsystem/src/main/kotlin/io/element/android/libraries/designsystem/components/avatar/UserAvatarPreview.kt

2
features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/components/TimelineItemEventRow.kt

@ -346,7 +346,7 @@ private fun MessageSenderInformation( @@ -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,

6
libraries/designsystem/src/main/kotlin/io/element/android/libraries/designsystem/components/avatar/Avatar.kt

@ -46,7 +46,7 @@ import timber.log.Timber @@ -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( @@ -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( @@ -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)

2
libraries/designsystem/src/main/kotlin/io/element/android/libraries/designsystem/components/avatar/UserAvatarPreview.kt

@ -43,7 +43,7 @@ internal fun UserAvatarPreview() = ElementPreview { @@ -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")
}
}

Loading…
Cancel
Save