mirror of
https://github.com/gedoor/legado.git
synced 2024-08-30 09:23:26 +08:00
优化
This commit is contained in:
parent
73afb399ff
commit
515088b67c
@ -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)
|
kotlin.runCatching {
|
||||||
} else if (AppConfig.isNightTheme) {
|
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(
|
||||||
|
Loading…
Reference in New Issue
Block a user