Fixed incorrect theme

This commit is contained in:
Prathamesh More 2022-01-17 20:11:28 +05:30
parent c7f7f9d695
commit 959235ad02
5 changed files with 10 additions and 14 deletions

View file

@ -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") {

View file

@ -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 -> {