pull/79/head
kunfei 5 years ago
parent 81c6f449eb
commit c1d349f176
  1. 10
      app/src/main/java/io/legado/app/App.kt

@ -22,6 +22,7 @@ import io.legado.app.lib.theme.ThemeStore
import io.legado.app.ui.book.read.page.ChapterProvider import io.legado.app.ui.book.read.page.ChapterProvider
import io.legado.app.utils.getCompatColor import io.legado.app.utils.getCompatColor
import io.legado.app.utils.getPrefInt import io.legado.app.utils.getPrefInt
import io.legado.app.utils.sysIsDarkMode
@Suppress("DEPRECATION") @Suppress("DEPRECATION")
class App : Application() { class App : Application() {
@ -102,7 +103,14 @@ class App : Application() {
} }
private fun initNightMode() { private fun initNightMode() {
val targetMode = if (AppConfig.isNightTheme) { val targetMode =
if (AppConfig.autoDarkMode) {
if (sysIsDarkMode()) {
AppCompatDelegate.MODE_NIGHT_YES
} else {
AppCompatDelegate.MODE_NIGHT_NO
}
} else if (AppConfig.isNightTheme) {
AppCompatDelegate.MODE_NIGHT_YES AppCompatDelegate.MODE_NIGHT_YES
} else { } else {
AppCompatDelegate.MODE_NIGHT_NO AppCompatDelegate.MODE_NIGHT_NO

Loading…
Cancel
Save