From 6897cc57212a1746c3efa334380cacfbdd013a82 Mon Sep 17 00:00:00 2001 From: bxdxnn <267911624+bxdxnn@users.noreply.github.com> Date: Sat, 25 Apr 2026 07:07:15 +0000 Subject: [PATCH] Add clipping to RoomSummaryRow --- .../home/impl/components/RoomSummaryRow.kt | 36 ++++++++++--------- 1 file changed, 19 insertions(+), 17 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 f541417104..72ecb5046d 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 @@ -29,6 +29,7 @@ import androidx.compose.runtime.Composable import androidx.compose.runtime.remember import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier +import androidx.compose.ui.draw.clipToBounds import androidx.compose.ui.graphics.Color import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.AnnotatedString @@ -222,20 +223,17 @@ private fun NameAndTimestampRow( modifier = modifier.fillMaxWidth(), horizontalArrangement = spacedBy(16.dp) ) { - Row( - modifier = Modifier.weight(1f), - verticalAlignment = Alignment.CenterVertically, - ) { - // Name - Text( - style = ElementTheme.typography.fontBodyLgMedium, - text = name?.toSafeLength(ellipsize = true) ?: stringResource(id = CommonStrings.common_no_room_name), - fontStyle = FontStyle.Italic.takeIf { name == null }, - color = ElementTheme.colors.roomListRoomName, - maxLines = 1, - overflow = TextOverflow.Ellipsis - ) - } + Text( + modifier = Modifier + .weight(1f) + .clipToBounds(), + style = ElementTheme.typography.fontBodyLgMedium, + text = name?.toSafeLength(ellipsize = true) ?: stringResource(id = CommonStrings.common_no_room_name), + fontStyle = FontStyle.Italic.takeIf { name == null }, + color = ElementTheme.colors.roomListRoomName, + maxLines = 1, + overflow = TextOverflow.Ellipsis + ) // Timestamp Text( text = timestamp ?: "", @@ -262,12 +260,12 @@ private fun InviteSubtitle( } if (subtitle != null) { Text( + modifier = modifier.clipToBounds(), text = subtitle, maxLines = 1, overflow = TextOverflow.Ellipsis, style = ElementTheme.typography.fontBodyMdRegular, color = ElementTheme.colors.roomListRoomMessage, - modifier = modifier, ) } } @@ -326,7 +324,9 @@ private fun MessagePreviewAndIndicatorRow( val messagePreview = room.latestEvent.content() val annotatedMessagePreview = messagePreview as? AnnotatedString ?: AnnotatedString(text = messagePreview.orEmpty().toString()) Text( - modifier = Modifier.weight(1f), + modifier = Modifier + .weight(1f) + .clipToBounds(), text = annotatedMessagePreview, color = ElementTheme.colors.roomListRoomMessage, style = ElementTheme.typography.fontBodyMdRegular, @@ -381,7 +381,9 @@ private fun InviteNameAndIndicatorRow( verticalAlignment = Alignment.CenterVertically, ) { Text( - modifier = Modifier.weight(1f), + modifier = Modifier + .weight(1f) + .clipToBounds(), style = ElementTheme.typography.fontBodyLgMedium, text = name?.toSafeLength(ellipsize = true) ?: stringResource(id = CommonStrings.common_no_room_name), fontStyle = FontStyle.Italic.takeIf { name == null },