Add support for Just Black with Material You

This commit is contained in:
Prathamesh More 2022-05-02 18:24:44 +05:30
parent aa4c20bd8c
commit 02f076de57
5 changed files with 8 additions and 4 deletions

View file

@ -44,12 +44,10 @@ class ThemeSettingsFragment : AbsSettingsFragment() {
generalTheme?.let { generalTheme?.let {
setSummary(it) setSummary(it)
it.setOnPreferenceChangeListener { _, newValue -> it.setOnPreferenceChangeListener { _, newValue ->
val theme = newValue as String
setSummary(it, newValue) setSummary(it, newValue)
ThemeStore.markChanged(requireContext()) ThemeStore.markChanged(requireContext())
if (VersionUtils.hasNougatMR()) { if (VersionUtils.hasNougatMR()) {
requireActivity().setTheme(PreferenceUtil.themeResFromPrefValue(theme))
DynamicShortcutManager(requireContext()).updateDynamicShortcuts() DynamicShortcutManager(requireContext()).updateDynamicShortcuts()
} }
restartActivity() restartActivity()

View file

@ -11,7 +11,8 @@ import code.name.monkey.retromusic.util.theme.ThemeMode.*
@StyleRes @StyleRes
fun Context.getThemeResValue(): Int = fun Context.getThemeResValue(): Int =
if (PreferenceUtil.materialYou) { if (PreferenceUtil.materialYou) {
R.style.Theme_RetroMusic_MD3 if (generalThemeValue == BLACK) R.style.Theme_RetroMusic_MD3_Black
else R.style.Theme_RetroMusic_MD3
} else { } else {
when (generalThemeValue) { when (generalThemeValue) {
LIGHT -> R.style.Theme_RetroMusic_Light LIGHT -> R.style.Theme_RetroMusic_Light

View file

@ -1,4 +1,8 @@
<resources> <resources>
<style name="Theme.RetroMusic.MD3.Black" parent="@style/Theme.RetroMusic.MD3">
<item name="colorSurface">@color/blackColorSurface</item>
</style>
<style name="Theme.AppWidget" parent="@android:style/Theme.DeviceDefault.DayNight"> <style name="Theme.AppWidget" parent="@android:style/Theme.DeviceDefault.DayNight">
<item name="colorSurface">@android:color/system_accent2_800</item> <item name="colorSurface">@android:color/system_accent2_800</item>
</style> </style>

View file

@ -11,6 +11,8 @@
<item name="android:windowBackground">?attr/colorSurface</item> <item name="android:windowBackground">?attr/colorSurface</item>
</style> </style>
<style name="Theme.RetroMusic.MD3.Black" parent="@style/Theme.RetroMusic.MD3" />
<style name="Theme.AppWidget" parent="@android:style/Theme.DeviceDefault.DayNight"> <style name="Theme.AppWidget" parent="@android:style/Theme.DeviceDefault.DayNight">
<item name="colorSurface">@android:color/system_accent1_50</item> <item name="colorSurface">@android:color/system_accent1_50</item>
</style> </style>

View file

@ -17,7 +17,6 @@
app:icon="@drawable/ic_color_lens" /> app:icon="@drawable/ic_color_lens" />
<code.name.monkey.appthemehelper.common.prefs.supportv7.ATESwitchPreference <code.name.monkey.appthemehelper.common.prefs.supportv7.ATESwitchPreference
android:dependency="material_you"
android:key="black_theme" android:key="black_theme"
android:layout="@layout/list_item_view_switch_no_title" android:layout="@layout/list_item_view_switch_no_title"
android:title="@string/black_theme_name" /> android:title="@string/black_theme_name" />