Applying Dynamic colors immediately on MD3 preference changed

main
Prathamesh More 2021-10-04 16:55:01 +05:30
parent 407cbb1020
commit 92b4a2fb57
1 changed files with 4 additions and 2 deletions

View File

@ -114,8 +114,10 @@ class ThemeSettingsFragment : AbsSettingsFragment() {
} }
val materialYou: ATESwitchPreference? = findPreference(MATERIAL_YOU) val materialYou: ATESwitchPreference? = findPreference(MATERIAL_YOU)
materialYou?.setOnPreferenceChangeListener { _, _ -> materialYou?.setOnPreferenceChangeListener { _, newValue ->
DynamicColors.applyToActivitiesIfAvailable(App.getContext()) if (newValue as Boolean) {
DynamicColors.applyToActivitiesIfAvailable(App.getContext())
}
restartActivity() restartActivity()
true true
} }