GitToTheHub commented on code in PR #1023:
URL:
https://github.com/apache/cordova-plugin-inappbrowser/pull/1023#discussion_r3000386045
##########
src/android/InAppBrowser.java:
##########
@@ -648,7 +651,11 @@ public String showWebPage(final String url,
HashMap<String, String> features) {
}
String zoom = features.get(ZOOM);
if (zoom != null) {
- showZoomControls = zoom.equals("yes") ? true : false;
+ enableZoom = zoom.equals("yes") ? true : false;
+ }
+ String zoomcontrols = features.get(ZOOMCONTROLS);
+ if (zoomcontrols != null) {
+ showZoomControls = zoomcontrols.equals("yes") ? true : false;
Review Comment:
This can be shortened:
```java
showZoomControls = zoomcontrols.equals("yes");
```
##########
src/android/InAppBrowser.java:
##########
@@ -648,7 +651,11 @@ public String showWebPage(final String url,
HashMap<String, String> features) {
}
String zoom = features.get(ZOOM);
if (zoom != null) {
- showZoomControls = zoom.equals("yes") ? true : false;
+ enableZoom = zoom.equals("yes") ? true : false;
Review Comment:
This can be shortened:
```java
enableZoom = zoom.equals("yes");
```
##########
src/android/InAppBrowser.java:
##########
@@ -946,7 +953,8 @@ public boolean onShowFileChooser (WebView webView,
ValueCallback<Uri[]> filePath
WebSettings settings = inAppWebView.getSettings();
settings.setJavaScriptEnabled(true);
settings.setJavaScriptCanOpenWindowsAutomatically(true);
- settings.setBuiltInZoomControls(showZoomControls);
+ settings.setBuiltInZoomControls(enableZoom);
Review Comment:
Add a small documentation here:
```java
// Enables built-in zoom mechanisms, which are on-screen zoom controls and
pinch-to-zoom.
// The on-screen zoom controls have to be enabled/disabled separately after.
// The on-screen zoom controls are deprecated since Android API Level 26
(Android 8).
settings.setBuiltInZoomControls(enableZoom);
```
##########
README.md:
##########
@@ -119,7 +119,8 @@ instance, or the system browser.
- __navigationbuttoncolor__: set to a valid hex color string, for example:
`#00ff00`, and it will change the color of both navigation buttons from
default. Only has effect if user has location set to `yes` and not
hidenavigationbuttons set to `yes`.
- __toolbarcolor__: set to a valid hex color string, for example:
`#00ff00`, and it will change the color the toolbar from default. Only has
effect if user has location set to `yes`.
- __lefttoright__: Set to `yes` to swap positions of the navigation
buttons and the close button. Specifically, navigation buttons go to the right
and close button to the left. Default value is `no`.
- - __zoom__: set to `yes` to show Android browser's zoom controls, set to
`no` to hide them. Default value is `yes`.
+ - __zoom__: set to `yes` to enable Android browser's zoom controls, set to
`no` to disable them. Default value is `yes`.
Review Comment:
The `zoom` options will only enable pinch-to-zoom, change the documentation
accordingly:
```
__zoom__: Enables pinch-to-zoom gesture. Set to `no` to disable it. Default
value is `yes`.
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]