pull/2309/head
kunfei 2 years ago
parent 73afb399ff
commit 515088b67c
  1. 8
      app/src/main/java/io/legado/app/utils/WebSettingsExtensions.kt

@ -13,8 +13,14 @@ import io.legado.app.help.config.AppConfig
@SuppressLint("RequiresFeature") @SuppressLint("RequiresFeature")
fun WebSettings.setDarkeningAllowed(allow: Boolean) { fun WebSettings.setDarkeningAllowed(allow: Boolean) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
kotlin.runCatching {
WebSettingsCompat.setAlgorithmicDarkeningAllowed(this, allow) WebSettingsCompat.setAlgorithmicDarkeningAllowed(this, allow)
} else if (AppConfig.isNightTheme) { return
}.onFailure {
it.printOnDebug()
}
}
if (AppConfig.isNightTheme) {
if (WebViewFeature.isFeatureSupported(WebViewFeature.FORCE_DARK_STRATEGY)) { if (WebViewFeature.isFeatureSupported(WebViewFeature.FORCE_DARK_STRATEGY)) {
@Suppress("DEPRECATION") @Suppress("DEPRECATION")
WebSettingsCompat.setForceDarkStrategy( WebSettingsCompat.setForceDarkStrategy(

Loading…
Cancel
Save