Fixed incorrect theme
This commit is contained in:
parent
c7f7f9d695
commit
959235ad02
5 changed files with 10 additions and 14 deletions
|
@ -46,8 +46,8 @@ abstract class AbsThemeActivity : ATHToolbarActivity(), Runnable {
|
|||
}
|
||||
|
||||
private fun updateTheme() {
|
||||
setTheme(ThemeManager.getThemeResValue(this))
|
||||
setDefaultNightMode(ThemeManager.getNightMode(this))
|
||||
setTheme(ThemeManager.getThemeResValue())
|
||||
setDefaultNightMode(ThemeManager.getNightMode())
|
||||
|
||||
if (PreferenceUtil.isCustomFont) {
|
||||
setTheme(R.style.FontThemeOverlay)
|
||||
|
|
|
@ -53,7 +53,7 @@ class RestoreActivity : AppCompatActivity() {
|
|||
}
|
||||
|
||||
private fun updateTheme() {
|
||||
AppCompatDelegate.setDefaultNightMode(ThemeManager.getNightMode(this))
|
||||
AppCompatDelegate.setDefaultNightMode(ThemeManager.getNightMode())
|
||||
|
||||
// Apply dynamic colors to activity if enabled
|
||||
if (PreferenceUtil.materialYou) {
|
||||
|
|
|
@ -79,7 +79,7 @@ object PreferenceUtil {
|
|||
fun getGeneralThemeValue(isSystemDark: Boolean): ThemeMode {
|
||||
val themeMode: String =
|
||||
sharedPreferences.getStringOrDefault(GENERAL_THEME, "auto")
|
||||
return if (isBlackMode && isSystemDark) {
|
||||
return if (isBlackMode && isSystemDark && themeMode != "light") {
|
||||
ThemeMode.BLACK
|
||||
} else {
|
||||
if (isBlackMode && themeMode == "dark") {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package code.name.monkey.retromusic.util.theme
|
||||
|
||||
import android.content.Context
|
||||
import androidx.annotation.StyleRes
|
||||
import androidx.appcompat.app.AppCompatDelegate
|
||||
import code.name.monkey.retromusic.App
|
||||
import code.name.monkey.retromusic.R
|
||||
import code.name.monkey.retromusic.extensions.generalThemeValue
|
||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||
|
@ -11,23 +11,19 @@ import code.name.monkey.retromusic.util.theme.ThemeMode.*
|
|||
object ThemeManager {
|
||||
|
||||
@StyleRes
|
||||
fun getThemeResValue(
|
||||
context: Context
|
||||
): Int =
|
||||
fun getThemeResValue(): Int =
|
||||
if (PreferenceUtil.materialYou) {
|
||||
R.style.Theme_RetroMusic_MD3
|
||||
} else {
|
||||
when (context.generalThemeValue) {
|
||||
when (App.getContext().generalThemeValue) {
|
||||
LIGHT -> R.style.Theme_RetroMusic_Light
|
||||
DARK -> R.style.Theme_RetroMusic_Base
|
||||
BLACK -> R.style.Theme_RetroMusic_Black
|
||||
AUTO -> R.style.Theme_RetroMusic_FollowSystem
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun getNightMode(
|
||||
context: Context
|
||||
): Int = when (context.generalThemeValue) {
|
||||
fun getNightMode(): Int = when (App.getContext().generalThemeValue) {
|
||||
LIGHT -> AppCompatDelegate.MODE_NIGHT_NO
|
||||
DARK -> AppCompatDelegate.MODE_NIGHT_YES
|
||||
BLACK -> {
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
<item name="popupMenuBackground">@drawable/popup_background</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.RetroMusic.Base" parent="Theme.Material3.DayNight.NoActionBar">
|
||||
<style name="Theme.RetroMusic.Base" parent="Theme.Material3.Dark.NoActionBar">
|
||||
<item name="md_background_color">@color/darkColorPrimary</item>
|
||||
<item name="android:windowActionBarOverlay">true</item>
|
||||
<item name="android:windowActivityTransitions">true</item>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue