diff --git a/android/src/main/java/ee/forgr/capacitor_inappbrowser/InAppBrowserPlugin.java b/android/src/main/java/ee/forgr/capacitor_inappbrowser/InAppBrowserPlugin.java index 9aa5ac97..e760f854 100644 --- a/android/src/main/java/ee/forgr/capacitor_inappbrowser/InAppBrowserPlugin.java +++ b/android/src/main/java/ee/forgr/capacitor_inappbrowser/InAppBrowserPlugin.java @@ -428,6 +428,8 @@ public void openWebView(PluginCall call) { Boolean.TRUE.equals(call.getBoolean("ignoreUntrustedSSLError", false)) ); + options.setTextZoom(call.getDouble("textZoom")); + String proxyRequestsStr = call.getString("proxyRequests"); if (proxyRequestsStr != null) { try { diff --git a/android/src/main/java/ee/forgr/capacitor_inappbrowser/Options.java b/android/src/main/java/ee/forgr/capacitor_inappbrowser/Options.java index 179d3a54..81f74d8b 100644 --- a/android/src/main/java/ee/forgr/capacitor_inappbrowser/Options.java +++ b/android/src/main/java/ee/forgr/capacitor_inappbrowser/Options.java @@ -131,6 +131,7 @@ public int getWidth() { private boolean ignoreUntrustedSSLError; private String preShowScript; private Pattern proxyRequestsPattern = null; + private Double textZoom; public Pattern getProxyRequestsPattern() { return proxyRequestsPattern; @@ -156,6 +157,14 @@ public void setTitle(String title) { this.title = title; } + public Double getTextZoom() { + return textZoom; + } + + public void setTextZoom(Double textZoom) { + this.textZoom = textZoom; + } + public boolean getCloseModal() { return CloseModal; } diff --git a/android/src/main/java/ee/forgr/capacitor_inappbrowser/WebViewDialog.java b/android/src/main/java/ee/forgr/capacitor_inappbrowser/WebViewDialog.java index 3b565bb2..790ba62f 100644 --- a/android/src/main/java/ee/forgr/capacitor_inappbrowser/WebViewDialog.java +++ b/android/src/main/java/ee/forgr/capacitor_inappbrowser/WebViewDialog.java @@ -191,7 +191,10 @@ public void presentWebView() { _webView.getSettings().setAllowFileAccessFromFileURLs(true); _webView.getSettings().setAllowUniversalAccessFromFileURLs(true); _webView.getSettings().setMediaPlaybackRequiresUserGesture(false); - + //text zoom + int rounded = (int) Math.round(_options.getTextZoom() * 100); + _webView.getSettings().setTextZoom(rounded); + _webView.setWebViewClient(new WebViewClient()); _webView.setWebChromeClient( diff --git a/src/definitions.ts b/src/definitions.ts index cbdbe059..f8cf06f6 100644 --- a/src/definitions.ts +++ b/src/definitions.ts @@ -257,6 +257,10 @@ export interface OpenWebViewOptions { height?: number; }; }; + /** + * text zoom in webview, 1.0 is 100%, 1.2 is 120% + */ + textZoom?: number } export interface InAppBrowserPlugin {