mirror of
https://github.com/gedoor/legado.git
synced 2024-07-17 00:58:29 +08:00
优化
This commit is contained in:
parent
73afb399ff
commit
515088b67c
@ -13,8 +13,14 @@ import io.legado.app.help.config.AppConfig
|
||||
@SuppressLint("RequiresFeature")
|
||||
fun WebSettings.setDarkeningAllowed(allow: Boolean) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||
WebSettingsCompat.setAlgorithmicDarkeningAllowed(this, allow)
|
||||
} else if (AppConfig.isNightTheme) {
|
||||
kotlin.runCatching {
|
||||
WebSettingsCompat.setAlgorithmicDarkeningAllowed(this, allow)
|
||||
return
|
||||
}.onFailure {
|
||||
it.printOnDebug()
|
||||
}
|
||||
}
|
||||
if (AppConfig.isNightTheme) {
|
||||
if (WebViewFeature.isFeatureSupported(WebViewFeature.FORCE_DARK_STRATEGY)) {
|
||||
@Suppress("DEPRECATION")
|
||||
WebSettingsCompat.setForceDarkStrategy(
|
||||
|
Loading…
Reference in New Issue
Block a user