From 6d93ce25aa92aee83362ec0b2d474cd7470f07d2 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Thu, 11 Dec 2025 13:52:30 +0100 Subject: [PATCH] RoomSummary: move the icon related to the last message state on start of the message. --- .../home/impl/components/RoomSummaryRow.kt | 50 ++++++++----------- 1 file changed, 22 insertions(+), 28 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 b722c63622..50b9559e94 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 @@ -121,7 +121,6 @@ internal fun RoomSummaryRow( ) { NameAndTimestampRow( name = room.name, - latestEvent = room.latestEvent, timestamp = room.timestamp, isHighlighted = room.isHighlighted ) @@ -138,7 +137,6 @@ internal fun RoomSummaryRow( ) { NameAndTimestampRow( name = room.name, - latestEvent = room.latestEvent, timestamp = null, isHighlighted = room.isHighlighted ) @@ -214,7 +212,6 @@ private fun RoomSummaryScaffoldRow( @Composable private fun NameAndTimestampRow( name: String?, - latestEvent: LatestEvent, timestamp: String?, isHighlighted: Boolean, modifier: Modifier = Modifier @@ -236,29 +233,6 @@ private fun NameAndTimestampRow( maxLines = 1, overflow = TextOverflow.Ellipsis ) - // Picto - when (latestEvent) { - is LatestEvent.Sending -> { - Spacer(modifier = Modifier.width(4.dp)) - Icon( - modifier = Modifier.size(16.dp), - imageVector = CompoundIcons.Time(), - contentDescription = stringResource(CommonStrings.common_sending), - tint = ElementTheme.colors.iconTertiary, - ) - } - is LatestEvent.Error -> { - Spacer(modifier = Modifier.width(4.dp)) - Icon( - modifier = Modifier.size(16.dp), - imageVector = CompoundIcons.ErrorSolid(), - // The last message contains the error. - contentDescription = null, - tint = ElementTheme.colors.iconCriticalPrimary, - ) - } - else -> Unit - } } // Timestamp Text( @@ -303,7 +277,6 @@ private fun MessagePreviewAndIndicatorRow( ) { Row( modifier = modifier.fillMaxWidth(), - horizontalArrangement = spacedBy(28.dp) ) { if (room.isTombstoned) { Text( @@ -317,6 +290,16 @@ private fun MessagePreviewAndIndicatorRow( ) } else { if (room.latestEvent is LatestEvent.Error) { + Icon( + modifier = Modifier + .padding(top = 2.dp) + .size(16.dp), + imageVector = CompoundIcons.ErrorSolid(), + // The last message contains the error. + contentDescription = null, + tint = ElementTheme.colors.iconCriticalPrimary, + ) + Spacer(modifier = Modifier.width(6.dp)) Text( modifier = Modifier.weight(1f), text = stringResource(CommonStrings.common_message_failed_to_send), @@ -327,6 +310,17 @@ private fun MessagePreviewAndIndicatorRow( overflow = TextOverflow.Ellipsis, ) } else { + if (room.latestEvent is LatestEvent.Sending) { + Icon( + modifier = Modifier + .padding(top = 2.dp) + .size(16.dp), + imageVector = CompoundIcons.Time(), + contentDescription = stringResource(CommonStrings.common_sending), + tint = ElementTheme.colors.iconTertiary, + ) + Spacer(modifier = Modifier.width(6.dp)) + } val messagePreview = room.latestEvent.content() val annotatedMessagePreview = messagePreview as? AnnotatedString ?: AnnotatedString(text = messagePreview.orEmpty().toString()) Text( @@ -340,7 +334,7 @@ private fun MessagePreviewAndIndicatorRow( ) } } - + Spacer(modifier = Modifier.width(16.dp)) // Call and unread Row( modifier = Modifier