mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 20:38:40 +00:00
Update icon and text when a room is a favorite.
This commit is contained in:
+7
-2
@@ -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(
|
||||||
|
|||||||
+1
-1
@@ -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)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
+7
-2
@@ -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
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user