diff --git a/features/space/impl/src/main/kotlin/io/element/android/features/space/impl/leave/LeaveSpaceStateProvider.kt b/features/space/impl/src/main/kotlin/io/element/android/features/space/impl/leave/LeaveSpaceStateProvider.kt index 0e1424c7b8..9f70a24939 100644 --- a/features/space/impl/src/main/kotlin/io/element/android/features/space/impl/leave/LeaveSpaceStateProvider.kt +++ b/features/space/impl/src/main/kotlin/io/element/android/features/space/impl/leave/LeaveSpaceStateProvider.kt @@ -30,6 +30,7 @@ class LeaveSpaceStateProvider : PreviewParameterProvider { persistentListOf( aSelectableSpaceRoom( spaceRoom = aSpaceRoom( + name = "A long space name that should be truncated", worldReadable = true, ), isLastAdmin = true, diff --git a/features/space/impl/src/main/kotlin/io/element/android/features/space/impl/leave/LeaveSpaceView.kt b/features/space/impl/src/main/kotlin/io/element/android/features/space/impl/leave/LeaveSpaceView.kt index bccacd0e47..8dea64c73e 100644 --- a/features/space/impl/src/main/kotlin/io/element/android/features/space/impl/leave/LeaveSpaceView.kt +++ b/features/space/impl/src/main/kotlin/io/element/android/features/space/impl/leave/LeaveSpaceView.kt @@ -25,6 +25,7 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.res.pluralStringResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.semantics.Role +import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.tooling.preview.PreviewParameter import androidx.compose.ui.unit.dp import io.element.android.compound.theme.ElementTheme @@ -254,6 +255,7 @@ private fun SpaceItem( color = ElementTheme.colors.textPrimary, style = ElementTheme.typography.fontBodyLgMedium, maxLines = 1, + overflow = TextOverflow.Ellipsis, ) Row( verticalAlignment = Alignment.CenterVertically, @@ -280,15 +282,26 @@ private fun SpaceItem( ) } // Number of members + val subTitle = buildString { + append( + pluralStringResource( + CommonPlurals.common_member_count, + room.numJoinedMembers, + room.numJoinedMembers + ) + ) + if (selectableSpaceRoom.isLastAdmin) { + append(" ") + append(stringResource(R.string.screen_leave_space_last_admin_info)) + } + } Text( modifier = Modifier.padding(end = 16.dp), - text = pluralStringResource( - CommonPlurals.common_member_count, - room.numJoinedMembers, - room.numJoinedMembers - ), + text = subTitle, color = ElementTheme.colors.textSecondary, style = ElementTheme.typography.fontBodyMdRegular, + maxLines = 1, + overflow = TextOverflow.Ellipsis, ) } } diff --git a/features/space/impl/src/main/res/values/localazy.xml b/features/space/impl/src/main/res/values/localazy.xml index 016682b46c..ac031defa3 100644 --- a/features/space/impl/src/main/res/values/localazy.xml +++ b/features/space/impl/src/main/res/values/localazy.xml @@ -1,5 +1,6 @@ + "(Admin)" "Leave %1$d room and space" "Leave %1$d rooms and space"