|
@@ -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) {
|
|
|
- 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)) {
|
|
if (WebViewFeature.isFeatureSupported(WebViewFeature.FORCE_DARK_STRATEGY)) {
|
|
|
@Suppress("DEPRECATION")
|
|
@Suppress("DEPRECATION")
|
|
|
WebSettingsCompat.setForceDarkStrategy(
|
|
WebSettingsCompat.setForceDarkStrategy(
|