Skip to content

Commit 46343b7

Browse files
committed
Add the (Admin) info.
1 parent 57285e2 commit 46343b7

File tree

3 files changed

+20
-5
lines changed

3 files changed

+20
-5
lines changed

features/space/impl/src/main/kotlin/io/element/android/features/space/impl/leave/LeaveSpaceStateProvider.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ class LeaveSpaceStateProvider : PreviewParameterProvider<LeaveSpaceState> {
3030
persistentListOf(
3131
aSelectableSpaceRoom(
3232
spaceRoom = aSpaceRoom(
33+
name = "A long space name that should be truncated",
3334
worldReadable = true,
3435
),
3536
isLastAdmin = true,

features/space/impl/src/main/kotlin/io/element/android/features/space/impl/leave/LeaveSpaceView.kt

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import androidx.compose.ui.Modifier
2525
import androidx.compose.ui.res.pluralStringResource
2626
import androidx.compose.ui.res.stringResource
2727
import androidx.compose.ui.semantics.Role
28+
import androidx.compose.ui.text.style.TextOverflow
2829
import androidx.compose.ui.tooling.preview.PreviewParameter
2930
import androidx.compose.ui.unit.dp
3031
import io.element.android.compound.theme.ElementTheme
@@ -254,6 +255,7 @@ private fun SpaceItem(
254255
color = ElementTheme.colors.textPrimary,
255256
style = ElementTheme.typography.fontBodyLgMedium,
256257
maxLines = 1,
258+
overflow = TextOverflow.Ellipsis,
257259
)
258260
Row(
259261
verticalAlignment = Alignment.CenterVertically,
@@ -280,15 +282,26 @@ private fun SpaceItem(
280282
)
281283
}
282284
// Number of members
285+
val subTitle = buildString {
286+
append(
287+
pluralStringResource(
288+
CommonPlurals.common_member_count,
289+
room.numJoinedMembers,
290+
room.numJoinedMembers
291+
)
292+
)
293+
if (selectableSpaceRoom.isLastAdmin) {
294+
append(" ")
295+
append(stringResource(R.string.screen_leave_space_last_admin_info))
296+
}
297+
}
283298
Text(
284299
modifier = Modifier.padding(end = 16.dp),
285-
text = pluralStringResource(
286-
CommonPlurals.common_member_count,
287-
room.numJoinedMembers,
288-
room.numJoinedMembers
289-
),
300+
text = subTitle,
290301
color = ElementTheme.colors.textSecondary,
291302
style = ElementTheme.typography.fontBodyMdRegular,
303+
maxLines = 1,
304+
overflow = TextOverflow.Ellipsis,
292305
)
293306
}
294307
}

features/space/impl/src/main/res/values/localazy.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
3+
<string name="screen_leave_space_last_admin_info">"(Admin)"</string>
34
<plurals name="screen_leave_space_submit">
45
<item quantity="one">"Leave %1$d room and space"</item>
56
<item quantity="other">"Leave %1$d rooms and space"</item>

0 commit comments

Comments
 (0)