Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add text zoom option with openWebView #258

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
4 changes: 4 additions & 0 deletions src/definitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down