FIX: The flag for ignore system colors appeared on API versions below 31
Signed-off-by: Guillermo Villafuerte <gvillafu@comunidad.unam.mx>
This commit is contained in:
parent
706bd38731
commit
01fe899c0c
@ -9,6 +9,7 @@ import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||
import androidx.lifecycle.viewmodel.compose.viewModel
|
||||
import de.mm20.launcher2.ktx.isAtLeastApiLevel
|
||||
import de.mm20.launcher2.preferences.Settings.AppearanceSettings
|
||||
import de.mm20.launcher2.preferences.Settings.AppearanceSettings.ColorScheme
|
||||
import de.mm20.launcher2.preferences.Settings.AppearanceSettings.Theme
|
||||
@ -52,15 +53,17 @@ fun AppearanceSettingsScreen() {
|
||||
navController?.navigate("settings/appearance/themes")
|
||||
}
|
||||
)
|
||||
val compatMode by viewModel.compatMode.collectAsState()
|
||||
SwitchPreference(
|
||||
title = stringResource(id = R.string.preference_force_compat_system_colors),
|
||||
summary = stringResource(id = R.string.preference_force_compat_system_colors_summary),
|
||||
value = compatMode,
|
||||
onValueChanged = {
|
||||
viewModel.setCompatMode(it)
|
||||
}
|
||||
)
|
||||
if (isAtLeastApiLevel(31)) {
|
||||
val compatMode by viewModel.compatMode.collectAsState()
|
||||
SwitchPreference(
|
||||
title = stringResource(id = R.string.preference_force_compat_system_colors),
|
||||
summary = stringResource(id = R.string.preference_force_compat_system_colors_summary),
|
||||
value = compatMode,
|
||||
onValueChanged = {
|
||||
viewModel.setCompatMode(it)
|
||||
}
|
||||
)
|
||||
}
|
||||
val font by viewModel.font.collectAsState()
|
||||
ListPreference(
|
||||
title = stringResource(R.string.preference_font),
|
||||
|
||||
@ -448,7 +448,7 @@
|
||||
<string name="preference_category_custom_colors_light">Light color scheme</string>
|
||||
<string name="preference_category_custom_colors_dark">Dark color scheme</string>
|
||||
<string name="preference_force_compat_system_colors">Ignore system colors</string>
|
||||
<string name="preference_force_compat_system_colors_summary">Request color scheme via Material You Compat, if available</string>
|
||||
<string name="preference_force_compat_system_colors_summary">Request color scheme via Material You Compat</string>
|
||||
<string name="preference_font">Font</string>
|
||||
<string name="preference_font_system">System default</string>
|
||||
<string name="preference_screen_about">About</string>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user