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

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

View file

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

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,13 +11,11 @@ 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
@ -25,9 +23,7 @@ object ThemeManager {
}
}
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 -> {

View file

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