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

Enable setTextZoom function of Android-WebViewSetting #81

Merged
merged 2 commits into from
Apr 26, 2019
Merged
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
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,8 @@ All platforms support:
- __databaseEnabled__: Set to `true` if you want the database storage API is enabled. The default value is `false`.
- __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`.
- __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:

Expand Down Expand Up @@ -1330,4 +1331,4 @@ CookieManager.deleteCookies(String url, {String domain = "", String path = "/"})
Removes all cookies.
```dart
CookieManager.deleteAllCookies();
```
```
Original file line number Diff line number Diff line change
Expand Up @@ -181,12 +181,7 @@ else if (options.clearSessionCache)
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) {
Expand Down Expand Up @@ -337,6 +332,9 @@ else if (newOptionsMap.get("clearSessionCache") != null && newOptions.clearSessi
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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}