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() {
|
private fun updateTheme() {
|
||||||
setTheme(ThemeManager.getThemeResValue(this))
|
setTheme(ThemeManager.getThemeResValue())
|
||||||
setDefaultNightMode(ThemeManager.getNightMode(this))
|
setDefaultNightMode(ThemeManager.getNightMode())
|
||||||
|
|
||||||
if (PreferenceUtil.isCustomFont) {
|
if (PreferenceUtil.isCustomFont) {
|
||||||
setTheme(R.style.FontThemeOverlay)
|
setTheme(R.style.FontThemeOverlay)
|
||||||
|
|
|
@ -53,7 +53,7 @@ class RestoreActivity : AppCompatActivity() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updateTheme() {
|
private fun updateTheme() {
|
||||||
AppCompatDelegate.setDefaultNightMode(ThemeManager.getNightMode(this))
|
AppCompatDelegate.setDefaultNightMode(ThemeManager.getNightMode())
|
||||||
|
|
||||||
// Apply dynamic colors to activity if enabled
|
// Apply dynamic colors to activity if enabled
|
||||||
if (PreferenceUtil.materialYou) {
|
if (PreferenceUtil.materialYou) {
|
||||||
|
|
|
@ -79,7 +79,7 @@ object PreferenceUtil {
|
||||||
fun getGeneralThemeValue(isSystemDark: Boolean): ThemeMode {
|
fun getGeneralThemeValue(isSystemDark: Boolean): ThemeMode {
|
||||||
val themeMode: String =
|
val themeMode: String =
|
||||||
sharedPreferences.getStringOrDefault(GENERAL_THEME, "auto")
|
sharedPreferences.getStringOrDefault(GENERAL_THEME, "auto")
|
||||||
return if (isBlackMode && isSystemDark) {
|
return if (isBlackMode && isSystemDark && themeMode != "light") {
|
||||||
ThemeMode.BLACK
|
ThemeMode.BLACK
|
||||||
} else {
|
} else {
|
||||||
if (isBlackMode && themeMode == "dark") {
|
if (isBlackMode && themeMode == "dark") {
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package code.name.monkey.retromusic.util.theme
|
package code.name.monkey.retromusic.util.theme
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import androidx.annotation.StyleRes
|
import androidx.annotation.StyleRes
|
||||||
import androidx.appcompat.app.AppCompatDelegate
|
import androidx.appcompat.app.AppCompatDelegate
|
||||||
|
import code.name.monkey.retromusic.App
|
||||||
import code.name.monkey.retromusic.R
|
import code.name.monkey.retromusic.R
|
||||||
import code.name.monkey.retromusic.extensions.generalThemeValue
|
import code.name.monkey.retromusic.extensions.generalThemeValue
|
||||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||||
|
@ -11,13 +11,11 @@ import code.name.monkey.retromusic.util.theme.ThemeMode.*
|
||||||
object ThemeManager {
|
object ThemeManager {
|
||||||
|
|
||||||
@StyleRes
|
@StyleRes
|
||||||
fun getThemeResValue(
|
fun getThemeResValue(): Int =
|
||||||
context: Context
|
|
||||||
): Int =
|
|
||||||
if (PreferenceUtil.materialYou) {
|
if (PreferenceUtil.materialYou) {
|
||||||
R.style.Theme_RetroMusic_MD3
|
R.style.Theme_RetroMusic_MD3
|
||||||
} else {
|
} else {
|
||||||
when (context.generalThemeValue) {
|
when (App.getContext().generalThemeValue) {
|
||||||
LIGHT -> R.style.Theme_RetroMusic_Light
|
LIGHT -> R.style.Theme_RetroMusic_Light
|
||||||
DARK -> R.style.Theme_RetroMusic_Base
|
DARK -> R.style.Theme_RetroMusic_Base
|
||||||
BLACK -> R.style.Theme_RetroMusic_Black
|
BLACK -> R.style.Theme_RetroMusic_Black
|
||||||
|
@ -25,9 +23,7 @@ object ThemeManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getNightMode(
|
fun getNightMode(): Int = when (App.getContext().generalThemeValue) {
|
||||||
context: Context
|
|
||||||
): Int = when (context.generalThemeValue) {
|
|
||||||
LIGHT -> AppCompatDelegate.MODE_NIGHT_NO
|
LIGHT -> AppCompatDelegate.MODE_NIGHT_NO
|
||||||
DARK -> AppCompatDelegate.MODE_NIGHT_YES
|
DARK -> AppCompatDelegate.MODE_NIGHT_YES
|
||||||
BLACK -> {
|
BLACK -> {
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
<item name="popupMenuBackground">@drawable/popup_background</item>
|
<item name="popupMenuBackground">@drawable/popup_background</item>
|
||||||
</style>
|
</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="md_background_color">@color/darkColorPrimary</item>
|
||||||
<item name="android:windowActionBarOverlay">true</item>
|
<item name="android:windowActionBarOverlay">true</item>
|
||||||
<item name="android:windowActivityTransitions">true</item>
|
<item name="android:windowActivityTransitions">true</item>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue