Merge pull request #81 from YouCii/master

Enable setTextZoom function of Android-WebViewSetting
This commit is contained in:
Lorenzo Pichilli 2019-04-26 15:16:48 +02:00 committed by GitHub
commit 43f16d0a2b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 8 deletions

View File

@ -250,6 +250,7 @@ All platforms support:
- __domStorageEnabled__: Set to `true` if you want the DOM storage API is enabled. The default value is `false`.
- __useWideViewPort__: Set to `true` if the WebView should enable support for the "viewport" HTML meta tag or should use a wide viewport. When the value of the setting is false, the layout width is always set to the width of the WebView control in device-independent (CSS) pixels. When the value is true and the page contains the viewport meta tag, the value of the width specified in the tag is used. If the page does not contain the tag or does not provide a width, then a wide viewport will be used. The default value is `true`.
- __safeBrowsingEnabled__: Set to `true` if you want the Safe Browsing is enabled. Safe Browsing allows WebView to protect against malware and phishing attacks by verifying the links. The default value is `true`.
- __textZoom__: Set text scaling of android-webview. The default value is `100`.
**iOS** supports these additional options:

View File

@ -183,12 +183,7 @@ public class InAppWebView extends WebView {
settings.setUseWideViewPort(options.useWideViewPort);
settings.setSupportZoom(options.supportZoom);
// fix webview scaling
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT)
settings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.TEXT_AUTOSIZING);
else
settings.setTextZoom(100);
settings.setTextZoom(options.textZoom);
}
public void loadUrl(String url, MethodChannel.Result result) {
@ -339,6 +334,9 @@ public class InAppWebView extends WebView {
if (newOptionsMap.get("supportZoom") != null && options.supportZoom != newOptions.supportZoom)
settings.setSupportZoom(newOptions.supportZoom);
if (newOptionsMap.get("textZoom") != null && options.textZoom != newOptions.textZoom)
settings.setTextZoom(newOptions.textZoom);
options = newOptions;
}

View File

@ -21,4 +21,6 @@ public class InAppWebViewOptions extends Options {
public boolean domStorageEnabled = false;
public boolean useWideViewPort = true;
public boolean safeBrowsingEnabled = true;
public int textZoom = 100;
}