diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/base/activity/BaseThemedActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/base/activity/BaseThemedActivity.kt
index afd4d1028..11ddee568 100644
--- a/app/src/main/java/eu/kanade/tachiyomi/ui/base/activity/BaseThemedActivity.kt
+++ b/app/src/main/java/eu/kanade/tachiyomi/ui/base/activity/BaseThemedActivity.kt
@@ -1,65 +1,39 @@
package eu.kanade.tachiyomi.ui.base.activity
-import android.content.res.Configuration
-import android.os.Build
+import android.content.res.Configuration.UI_MODE_NIGHT_MASK
+import android.content.res.Configuration.UI_MODE_NIGHT_YES
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import eu.kanade.tachiyomi.R
+import eu.kanade.tachiyomi.data.preference.PreferenceValues.DarkThemeVariant
+import eu.kanade.tachiyomi.data.preference.PreferenceValues.LightThemeVariant
+import eu.kanade.tachiyomi.data.preference.PreferenceValues.ThemeMode
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
import uy.kohesive.injekt.injectLazy
-import eu.kanade.tachiyomi.data.preference.PreferenceValues as Values
abstract class BaseThemedActivity : AppCompatActivity() {
val preferences: PreferencesHelper by injectLazy()
- private val isDarkMode: Boolean by lazy {
- val themeMode = preferences.themeMode().get()
- (themeMode == Values.ThemeMode.dark) ||
- (
- themeMode == Values.ThemeMode.system &&
- (resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK == Configuration.UI_MODE_NIGHT_YES)
- )
- }
-
- private val lightTheme: Int by lazy {
- when (preferences.themeLight().get()) {
- Values.LightThemeVariant.blue -> R.style.Theme_Tachiyomi_LightBlue
- else -> {
- when {
- // Light status + navigation bar
- Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1 -> {
- R.style.Theme_Tachiyomi_Light_Api27
- }
- // Light status bar + fallback gray navigation bar
- Build.VERSION.SDK_INT >= Build.VERSION_CODES.M -> {
- R.style.Theme_Tachiyomi_Light_Api23
- }
- // Fallback gray status + navigation bar
- else -> {
- R.style.Theme_Tachiyomi_Light
- }
- }
- }
- }
- }
-
- private val darkTheme: Int by lazy {
- when (preferences.themeDark().get()) {
- Values.DarkThemeVariant.blue -> R.style.Theme_Tachiyomi_DarkBlue
- Values.DarkThemeVariant.amoled -> R.style.Theme_Tachiyomi_Amoled
- else -> R.style.Theme_Tachiyomi_Dark
- }
- }
-
override fun onCreate(savedInstanceState: Bundle?) {
- setTheme(
- when {
- isDarkMode -> darkTheme
- else -> lightTheme
+ val isDarkMode = when (preferences.themeMode().get()) {
+ ThemeMode.light -> false
+ ThemeMode.dark -> true
+ ThemeMode.system -> resources.configuration.uiMode and UI_MODE_NIGHT_MASK == UI_MODE_NIGHT_YES
+ }
+ val themeId = if (isDarkMode) {
+ when (preferences.themeDark().get()) {
+ DarkThemeVariant.default -> R.style.Theme_Tachiyomi_Dark
+ DarkThemeVariant.blue -> R.style.Theme_Tachiyomi_Dark_Blue
+ DarkThemeVariant.amoled -> R.style.Theme_Tachiyomi_Dark_Amoled
}
- )
-
+ } else {
+ when (preferences.themeLight().get()) {
+ LightThemeVariant.default -> R.style.Theme_Tachiyomi_Light
+ LightThemeVariant.blue -> R.style.Theme_Tachiyomi_Light_Blue
+ }
+ }
+ setTheme(themeId)
super.onCreate(savedInstanceState)
}
}
diff --git a/app/src/main/res/values-v23/themes.xml b/app/src/main/res/values-v23/themes.xml
index 73607f42f..49f3e5ea6 100644
--- a/app/src/main/res/values-v23/themes.xml
+++ b/app/src/main/res/values-v23/themes.xml
@@ -1,9 +1,9 @@
-
-
+
diff --git a/app/src/main/res/values-v27/themes.xml b/app/src/main/res/values-v27/themes.xml
index acffe0155..a3a23ef2f 100644
--- a/app/src/main/res/values-v27/themes.xml
+++ b/app/src/main/res/values-v27/themes.xml
@@ -1,12 +1,9 @@
-
-
+
diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml
index 756725679..75ab61b32 100644
--- a/app/src/main/res/values/themes.xml
+++ b/app/src/main/res/values/themes.xml
@@ -47,8 +47,9 @@
- locale
- - ?attr/colorPrimary
- - ?attr/colorPrimary
+ - @color/md_black_1000
+ - @color/md_black_1000
+ - @null
- false
- true
- false
@@ -84,28 +85,24 @@
- ?attr/colorAccent
- @color/selectorColorLight
- - @color/filterColorDark
+ - @color/filterColorLight
-
-
-
@@ -145,6 +142,7 @@
- ?attr/colorPrimary
- ?attr/colorPrimary
+ - @null
- false
- true
- false
@@ -184,16 +182,15 @@
- @color/filterColorDark
-
+
-
-