feature (space) : add string "No space name"
This commit is contained in:
parent
5cda6730c4
commit
dd13605085
4 changed files with 17 additions and 6 deletions
|
|
@ -183,7 +183,7 @@ private fun SpaceAvatarAndNameRow(
|
||||||
.semantics {
|
.semantics {
|
||||||
heading()
|
heading()
|
||||||
},
|
},
|
||||||
text = name ?: stringResource(CommonStrings.common_no_room_name),
|
text = name ?: stringResource(CommonStrings.common_no_space_name),
|
||||||
style = ElementTheme.typography.fontBodyLgMedium,
|
style = ElementTheme.typography.fontBodyLgMedium,
|
||||||
fontStyle = FontStyle.Italic.takeIf { name == null },
|
fontStyle = FontStyle.Italic.takeIf { name == null },
|
||||||
maxLines = 1,
|
maxLines = 1,
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,8 @@ package io.element.android.libraries.matrix.ui.components
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.res.stringResource
|
||||||
|
import androidx.compose.ui.text.font.FontStyle
|
||||||
import androidx.compose.ui.tooling.preview.datasource.LoremIpsum
|
import androidx.compose.ui.tooling.preview.datasource.LoremIpsum
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import io.element.android.libraries.designsystem.atomic.atoms.RoomPreviewDescriptionAtom
|
import io.element.android.libraries.designsystem.atomic.atoms.RoomPreviewDescriptionAtom
|
||||||
|
|
@ -24,6 +26,7 @@ import io.element.android.libraries.designsystem.preview.ElementPreview
|
||||||
import io.element.android.libraries.designsystem.preview.PreviewsDayNight
|
import io.element.android.libraries.designsystem.preview.PreviewsDayNight
|
||||||
import io.element.android.libraries.matrix.api.room.join.JoinRule
|
import io.element.android.libraries.matrix.api.room.join.JoinRule
|
||||||
import io.element.android.libraries.matrix.api.user.MatrixUser
|
import io.element.android.libraries.matrix.api.user.MatrixUser
|
||||||
|
import io.element.android.libraries.ui.strings.CommonStrings
|
||||||
import kotlinx.collections.immutable.ImmutableList
|
import kotlinx.collections.immutable.ImmutableList
|
||||||
import kotlinx.collections.immutable.persistentListOf
|
import kotlinx.collections.immutable.persistentListOf
|
||||||
|
|
||||||
|
|
@ -51,8 +54,13 @@ fun SpaceHeaderView(
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
title = {
|
title = {
|
||||||
name?.let {
|
if (name != null) {
|
||||||
RoomPreviewTitleAtom(title = name)
|
RoomPreviewTitleAtom(title = name)
|
||||||
|
} else {
|
||||||
|
RoomPreviewTitleAtom(
|
||||||
|
title = stringResource(id = CommonStrings.common_no_space_name),
|
||||||
|
fontStyle = FontStyle.Italic
|
||||||
|
)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
subtitle = {
|
subtitle = {
|
||||||
|
|
@ -63,10 +71,10 @@ fun SpaceHeaderView(
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
description = if (topic != null) {
|
description = if (topic.isNullOrBlank()) {
|
||||||
{ RoomPreviewDescriptionAtom(description = topic, maxLines = topicMaxLines) }
|
|
||||||
} else {
|
|
||||||
null
|
null
|
||||||
|
} else {
|
||||||
|
{ RoomPreviewDescriptionAtom(description = topic, maxLines = topicMaxLines) }
|
||||||
},
|
},
|
||||||
memberCount = {
|
memberCount = {
|
||||||
SpaceMembersView(
|
SpaceMembersView(
|
||||||
|
|
|
||||||
|
|
@ -69,6 +69,7 @@ fun SpaceRoomItemView(
|
||||||
onLongClick = onLongClick,
|
onLongClick = onLongClick,
|
||||||
) {
|
) {
|
||||||
NameAndIndicatorRow(
|
NameAndIndicatorRow(
|
||||||
|
isSpace = spaceRoom.isSpace,
|
||||||
name = spaceRoom.name,
|
name = spaceRoom.name,
|
||||||
showIndicator = showUnreadIndicator
|
showIndicator = showUnreadIndicator
|
||||||
)
|
)
|
||||||
|
|
@ -130,6 +131,7 @@ private fun SubtitleRow(
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun NameAndIndicatorRow(
|
private fun NameAndIndicatorRow(
|
||||||
|
isSpace: Boolean,
|
||||||
name: String?,
|
name: String?,
|
||||||
showIndicator: Boolean,
|
showIndicator: Boolean,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
|
|
@ -142,7 +144,7 @@ private fun NameAndIndicatorRow(
|
||||||
Text(
|
Text(
|
||||||
modifier = Modifier.weight(1f),
|
modifier = Modifier.weight(1f),
|
||||||
style = ElementTheme.typography.fontBodyLgMedium,
|
style = ElementTheme.typography.fontBodyLgMedium,
|
||||||
text = name ?: stringResource(id = CommonStrings.common_no_room_name),
|
text = name ?: stringResource(id = if(isSpace) CommonStrings.common_no_space_name else CommonStrings.common_no_room_name),
|
||||||
fontStyle = FontStyle.Italic.takeIf { name == null },
|
fontStyle = FontStyle.Italic.takeIf { name == null },
|
||||||
color = ElementTheme.colors.textPrimary,
|
color = ElementTheme.colors.textPrimary,
|
||||||
maxLines = 1,
|
maxLines = 1,
|
||||||
|
|
|
||||||
|
|
@ -246,6 +246,7 @@ Reason: %1$s."</string>
|
||||||
<string name="common_name_and_id">"%1$s (%2$s)"</string>
|
<string name="common_name_and_id">"%1$s (%2$s)"</string>
|
||||||
<string name="common_no_results">"No results"</string>
|
<string name="common_no_results">"No results"</string>
|
||||||
<string name="common_no_room_name">"No room name"</string>
|
<string name="common_no_room_name">"No room name"</string>
|
||||||
|
<string name="common_no_space_name">"No space name"</string>
|
||||||
<string name="common_not_encrypted">"Not encrypted"</string>
|
<string name="common_not_encrypted">"Not encrypted"</string>
|
||||||
<string name="common_offline">"Offline"</string>
|
<string name="common_offline">"Offline"</string>
|
||||||
<string name="common_open_source_licenses">"Open source licenses"</string>
|
<string name="common_open_source_licenses">"Open source licenses"</string>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue