Applying Dynamic colors immediately on MD3 preference changed

main
Prathamesh More 2021-10-04 11:23:40 +05:30
parent 03b9e36014
commit 9cf787bc04
1 changed files with 2 additions and 0 deletions

View File

@ -30,6 +30,7 @@ import code.name.monkey.retromusic.appshortcuts.DynamicShortcutManager
import code.name.monkey.retromusic.util.PreferenceUtil
import com.afollestad.materialdialogs.MaterialDialog
import com.afollestad.materialdialogs.color.colorChooser
import com.google.android.material.color.DynamicColors
/**
* @author Hemanth S (h4h13).
@ -114,6 +115,7 @@ class ThemeSettingsFragment : AbsSettingsFragment() {
val materialYou: ATESwitchPreference? = findPreference(MATERIAL_YOU)
materialYou?.setOnPreferenceChangeListener { _, _ ->
DynamicColors.applyToActivitiesIfAvailable(App.getContext())
restartActivity()
true
}