|
|
@ -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,11 +103,18 @@ class App : Application() { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private fun initNightMode() { |
|
|
|
private fun initNightMode() { |
|
|
|
val targetMode = if (AppConfig.isNightTheme) { |
|
|
|
val targetMode = |
|
|
|
AppCompatDelegate.MODE_NIGHT_YES |
|
|
|
if (AppConfig.autoDarkMode) { |
|
|
|
} else { |
|
|
|
if (sysIsDarkMode()) { |
|
|
|
AppCompatDelegate.MODE_NIGHT_NO |
|
|
|
AppCompatDelegate.MODE_NIGHT_YES |
|
|
|
} |
|
|
|
} else { |
|
|
|
|
|
|
|
AppCompatDelegate.MODE_NIGHT_NO |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else if (AppConfig.isNightTheme) { |
|
|
|
|
|
|
|
AppCompatDelegate.MODE_NIGHT_YES |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
AppCompatDelegate.MODE_NIGHT_NO |
|
|
|
|
|
|
|
} |
|
|
|
AppCompatDelegate.setDefaultNightMode(targetMode) |
|
|
|
AppCompatDelegate.setDefaultNightMode(targetMode) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|