Update icon and text when a room is a favorite.
This commit is contained in:
parent
fd9cc15763
commit
020484f605
3 changed files with 15 additions and 5 deletions
|
|
@ -131,16 +131,21 @@ private fun RoomListModalBottomSheetContent(
|
||||||
style = ListItemStyle.Primary,
|
style = ListItemStyle.Primary,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
val (textResId, icon) = if (contextMenu.isFavorite) {
|
||||||
|
CommonStrings.common_favourited to CompoundIcons.FavouriteSolid()
|
||||||
|
} else {
|
||||||
|
CommonStrings.common_favourite to CompoundIcons.Favourite()
|
||||||
|
}
|
||||||
ListItem(
|
ListItem(
|
||||||
headlineContent = {
|
headlineContent = {
|
||||||
Text(
|
Text(
|
||||||
text = stringResource(id = CommonStrings.common_favourite),
|
text = stringResource(id = textResId),
|
||||||
style = MaterialTheme.typography.bodyLarge,
|
style = MaterialTheme.typography.bodyLarge,
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
leadingContent = ListItemContent.Icon(
|
leadingContent = ListItemContent.Icon(
|
||||||
iconSource = IconSource.Vector(
|
iconSource = IconSource.Vector(
|
||||||
CompoundIcons.Favourite(),
|
icon,
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
trailingContent = ListItemContent.Switch(
|
trailingContent = ListItemContent.Switch(
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ open class RoomListStateContextMenuShownProvider : PreviewParameterProvider<Room
|
||||||
override val values: Sequence<RoomListState.ContextMenu.Shown>
|
override val values: Sequence<RoomListState.ContextMenu.Shown>
|
||||||
get() = sequenceOf(
|
get() = sequenceOf(
|
||||||
aContextMenuShown(hasNewContent = true),
|
aContextMenuShown(hasNewContent = true),
|
||||||
aContextMenuShown(isDm = true),
|
aContextMenuShown(isDm = true, isFavorite = true),
|
||||||
aContextMenuShown(roomName = null)
|
aContextMenuShown(roomName = null)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -589,9 +589,14 @@ private fun FavoriteItem(
|
||||||
isFavorite: Boolean,
|
isFavorite: Boolean,
|
||||||
onFavoriteChanges: (Boolean) -> Unit,
|
onFavoriteChanges: (Boolean) -> Unit,
|
||||||
) {
|
) {
|
||||||
|
val (textResId, icon) = if (isFavorite) {
|
||||||
|
CommonStrings.common_favourited to CompoundIcons.FavouriteSolid()
|
||||||
|
} else {
|
||||||
|
CommonStrings.common_favourite to CompoundIcons.Favourite()
|
||||||
|
}
|
||||||
PreferenceSwitch(
|
PreferenceSwitch(
|
||||||
icon = CompoundIcons.Favourite(),
|
icon = icon,
|
||||||
title = stringResource(id = CommonStrings.common_favourite),
|
title = stringResource(id = textResId),
|
||||||
isChecked = isFavorite,
|
isChecked = isFavorite,
|
||||||
onCheckedChange = onFavoriteChanges
|
onCheckedChange = onFavoriteChanges
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue