From 2a2c6cee5f3a4d02aa2bfcd4ea0cfb316e3ceb90 Mon Sep 17 00:00:00 2001 From: arkon Date: Mon, 21 Nov 2022 18:39:16 -0500 Subject: [PATCH] Allow zooming in WebView Note that this does not force-enable zooming on pages with set viewports (which typically implies proper mobile scaling). Closes #8588 --- .../java/eu/kanade/presentation/webview/WebViewScreen.kt | 5 ++++- .../main/java/eu/kanade/tachiyomi/util/system/WebViewUtil.kt | 5 +++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/eu/kanade/presentation/webview/WebViewScreen.kt b/app/src/main/java/eu/kanade/presentation/webview/WebViewScreen.kt index 13c9ab075..4c9e393c5 100644 --- a/app/src/main/java/eu/kanade/presentation/webview/WebViewScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/webview/WebViewScreen.kt @@ -4,6 +4,7 @@ import android.content.pm.ApplicationInfo import android.webkit.WebResourceRequest import android.webkit.WebView import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.material.icons.Icons @@ -125,7 +126,9 @@ fun WebViewScreen( WebView( state = state, - modifier = Modifier.padding(contentPadding), + modifier = Modifier + .padding(contentPadding) + .fillMaxSize(), navigator = navigator, onCreated = { webView -> webView.setDefaultSettings() diff --git a/core/src/main/java/eu/kanade/tachiyomi/util/system/WebViewUtil.kt b/core/src/main/java/eu/kanade/tachiyomi/util/system/WebViewUtil.kt index aac0d310b..1fb58385b 100644 --- a/core/src/main/java/eu/kanade/tachiyomi/util/system/WebViewUtil.kt +++ b/core/src/main/java/eu/kanade/tachiyomi/util/system/WebViewUtil.kt @@ -40,6 +40,11 @@ fun WebView.setDefaultSettings() { useWideViewPort = true loadWithOverviewMode = true cacheMode = WebSettings.LOAD_DEFAULT + + // Allow zooming + setSupportZoom(true) + builtInZoomControls = true + displayZoomControls = false } }