From f8e25381f44462023838f536664ce440de3ec4db Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Tue, 8 Jul 2025 17:46:12 +0200 Subject: [PATCH] Change fun to val and extend SemanticColors --- .../home/impl/components/RoomSummaryRow.kt | 10 +++++----- .../designsystem/theme/ColorAliases.kt | 18 +++++++++--------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/features/home/impl/src/main/kotlin/io/element/android/features/home/impl/components/RoomSummaryRow.kt b/features/home/impl/src/main/kotlin/io/element/android/features/home/impl/components/RoomSummaryRow.kt index e5a85a7442..b37e9ea223 100644 --- a/features/home/impl/src/main/kotlin/io/element/android/features/home/impl/components/RoomSummaryRow.kt +++ b/features/home/impl/src/main/kotlin/io/element/android/features/home/impl/components/RoomSummaryRow.kt @@ -219,7 +219,7 @@ private fun NameAndTimestampRow( style = ElementTheme.typography.fontBodyLgMedium, text = name ?: stringResource(id = CommonStrings.common_no_room_name), fontStyle = FontStyle.Italic.takeIf { name == null }, - color = ElementTheme.roomListRoomName(), + color = ElementTheme.colors.roomListRoomName, maxLines = 1, overflow = TextOverflow.Ellipsis ) @@ -230,7 +230,7 @@ private fun NameAndTimestampRow( color = if (isHighlighted) { ElementTheme.colors.unreadIndicator } else { - ElementTheme.roomListRoomMessageDate() + ElementTheme.colors.roomListRoomMessageDate }, ) } @@ -253,7 +253,7 @@ private fun InviteSubtitle( maxLines = 1, overflow = TextOverflow.Ellipsis, style = ElementTheme.typography.fontBodyMdRegular, - color = ElementTheme.roomListRoomMessage(), + color = ElementTheme.colors.roomListRoomMessage, modifier = modifier, ) } @@ -277,7 +277,7 @@ private fun MessagePreviewAndIndicatorRow( Text( modifier = Modifier.weight(1f), text = annotatedMessagePreview, - color = ElementTheme.roomListRoomMessage(), + color = ElementTheme.colors.roomListRoomMessage, style = ElementTheme.typography.fontBodyMdRegular, minLines = 2, maxLines = 2, @@ -325,7 +325,7 @@ private fun InviteNameAndIndicatorRow( style = ElementTheme.typography.fontBodyLgMedium, text = name ?: stringResource(id = CommonStrings.common_no_room_name), fontStyle = FontStyle.Italic.takeIf { name == null }, - color = ElementTheme.roomListRoomName(), + color = ElementTheme.colors.roomListRoomName, maxLines = 1, overflow = TextOverflow.Ellipsis ) diff --git a/libraries/designsystem/src/main/kotlin/io/element/android/libraries/designsystem/theme/ColorAliases.kt b/libraries/designsystem/src/main/kotlin/io/element/android/libraries/designsystem/theme/ColorAliases.kt index 59831e99f2..8f6224eca9 100644 --- a/libraries/designsystem/src/main/kotlin/io/element/android/libraries/designsystem/theme/ColorAliases.kt +++ b/libraries/designsystem/src/main/kotlin/io/element/android/libraries/designsystem/theme/ColorAliases.kt @@ -22,14 +22,14 @@ import kotlinx.collections.immutable.persistentMapOf /** * Room list. */ -@Composable -fun ElementTheme.roomListRoomName() = colors.textPrimary +val SemanticColors.roomListRoomName + get() = textPrimary -@Composable -fun ElementTheme.roomListRoomMessage() = colors.textSecondary +val SemanticColors.roomListRoomMessage + get() = textSecondary -@Composable -fun ElementTheme.roomListRoomMessageDate() = colors.textSecondary +val SemanticColors.roomListRoomMessageDate + get() = textSecondary val SemanticColors.unreadIndicator get() = iconAccentTertiary @@ -81,9 +81,9 @@ internal fun ColorAliasesPreview() = ElementPreview { backgroundColor = Color.Black, foregroundColor = Color.White, colors = persistentMapOf( - "roomListRoomName" to ElementTheme.roomListRoomName(), - "roomListRoomMessage" to ElementTheme.roomListRoomMessage(), - "roomListRoomMessageDate" to ElementTheme.roomListRoomMessageDate(), + "roomListRoomName" to ElementTheme.colors.roomListRoomName, + "roomListRoomMessage" to ElementTheme.colors.roomListRoomMessage, + "roomListRoomMessageDate" to ElementTheme.colors.roomListRoomMessageDate, "unreadIndicator" to ElementTheme.colors.unreadIndicator, "placeholderBackground" to ElementTheme.colors.placeholderBackground, "messageFromMeBackground" to ElementTheme.colors.messageFromMeBackground,