feat: dynamic color toggle
This commit is contained in:
parent
7a34c03981
commit
ebd0f74a3a
5 changed files with 11 additions and 4 deletions
|
|
@ -47,6 +47,7 @@ class MainActivity : ComponentActivity() {
|
|||
setContent {
|
||||
ManagerTheme(
|
||||
isDarkTheme = preferences.theme == Theme.DARK || preferences.theme == Theme.SYSTEM && isSystemInDarkTheme(),
|
||||
isDynamicColor = preferences.dynamicColor
|
||||
) {
|
||||
val navigator = rememberBackstackNavigator<AppDestination>(AppDestination.Home)
|
||||
|
||||
|
|
@ -65,7 +66,6 @@ class MainActivity : ComponentActivity() {
|
|||
onClickAbout = { navigator.push(AppDestination.About) },
|
||||
onClickSettings = { navigator.push(AppDestination.Settings) }
|
||||
)
|
||||
is AppDestination.Plugins -> PluginsScreen()
|
||||
is AppDestination.Install -> InstallerScreen(
|
||||
onClickBack = navigator::pop,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import com.aliucord.manager.ui.theme.Theme
|
|||
|
||||
class PreferencesManager(preferences: SharedPreferences) : BasePreferenceManager(preferences) {
|
||||
var theme by enumPreference("theme", Theme.SYSTEM)
|
||||
var dynamicColor by booleanPreference("dynamic_color", true)
|
||||
var replaceBg by booleanPreference("replace_bg", true)
|
||||
var devMode by booleanPreference("dev_mode", false)
|
||||
var debuggable by booleanPreference("debuggable", false)
|
||||
|
|
|
|||
|
|
@ -17,9 +17,6 @@ sealed interface AppDestination : Destination {
|
|||
@Parcelize
|
||||
object Home : AppDestination
|
||||
|
||||
@Parcelize
|
||||
object Plugins : AppDestination
|
||||
|
||||
@Parcelize
|
||||
object Install : AppDestination
|
||||
|
||||
|
|
|
|||
|
|
@ -72,6 +72,12 @@ fun SettingsScreen(
|
|||
}
|
||||
)
|
||||
|
||||
SwitchSetting(
|
||||
checked = preferences.dynamicColor,
|
||||
title = { Text(stringResource(R.string.dynamic_color)) },
|
||||
onCheckedChange = { preferences.dynamicColor = it }
|
||||
)
|
||||
|
||||
Divider()
|
||||
|
||||
OutlinedTextField(
|
||||
|
|
@ -158,6 +164,7 @@ fun SwitchSetting(
|
|||
title: @Composable () -> Unit,
|
||||
description: @Composable (() -> Unit)? = null,
|
||||
onCheckedChange: (Boolean) -> Unit,
|
||||
enabled: Boolean = true
|
||||
) {
|
||||
ListItem(
|
||||
modifier = Modifier.clickable { onCheckedChange(!checked) },
|
||||
|
|
@ -166,6 +173,7 @@ fun SwitchSetting(
|
|||
supportingText = description,
|
||||
trailingContent = {
|
||||
Switch(
|
||||
enabled = enabled,
|
||||
checked = checked,
|
||||
onCheckedChange = onCheckedChange
|
||||
)
|
||||
|
|
|
|||
|
|
@ -48,4 +48,5 @@
|
|||
<string name="launch">Launch</string>
|
||||
<string name="uninstall">Uninstall</string>
|
||||
<string name="version">Version</string>
|
||||
<string name="dynamic_color">Dynamic color</string>
|
||||
</resources>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue