(fix) incorrect shape scheme name on appearance settings screen

This commit is contained in:
MM20 2025-06-01 18:13:42 +02:00
parent 76a2766b07
commit c7a66821ac
No known key found for this signature in database
GPG Key ID: 0B61A8F2DEAFA389
2 changed files with 12 additions and 5 deletions

View File

@ -4,7 +4,6 @@ import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.rounded.CropSquare
import androidx.compose.material.icons.rounded.Palette
import androidx.compose.material.icons.rounded.TextFields
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.collectAsState
@ -31,7 +30,8 @@ fun AppearanceSettingsScreen() {
val viewModel: AppearanceSettingsScreenVM = viewModel()
val context = LocalContext.current
val navController = LocalNavController.current
val themeName by viewModel.themeName.collectAsStateWithLifecycle(null)
val colorThemeName by viewModel.colorThemeName.collectAsStateWithLifecycle(null)
val shapeThemeName by viewModel.shapeThemeName.collectAsStateWithLifecycle(null)
val compatModeColors by viewModel.compatModeColors.collectAsState()
PreferenceScreen(title = stringResource(id = R.string.preference_screen_appearance)) {
item {
@ -56,7 +56,7 @@ fun AppearanceSettingsScreen() {
PreferenceCategory {
Preference(
title = stringResource(id = R.string.preference_screen_colors),
summary = themeName,
summary = colorThemeName,
onClick = {
navController?.navigate("settings/appearance/colors")
},
@ -83,7 +83,7 @@ fun AppearanceSettingsScreen() {
)
Preference(
title = stringResource(id = R.string.preference_screen_shapes),
summary = themeName,
summary = shapeThemeName,
onClick = {
navController?.navigate("settings/appearance/shapes")
},

View File

@ -25,13 +25,20 @@ class AppearanceSettingsScreenVM : ViewModel(), KoinComponent {
uiSettings.setColorScheme(colorScheme)
}
val themeName = uiSettings.colors.flatMapLatest {
val colorThemeName = uiSettings.colors.flatMapLatest {
themeRepository.getColorsOrDefault(it)
}.map {
it.name
}
.stateIn(viewModelScope, SharingStarted.WhileSubscribed(), null)
val shapeThemeName = uiSettings.shapes.flatMapLatest {
themeRepository.getShapesOrDefault(it)
}.map {
it.name
}
.stateIn(viewModelScope, SharingStarted.WhileSubscribed(), null)
val compatModeColors = uiSettings.compatModeColors
.stateIn(viewModelScope, SharingStarted.WhileSubscribed(), false)