GH-1022 android: enable zoom without on-screen controls
This commit is contained in:
parent
d533f2a953
commit
283957d788
@ -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`.
|
||||
- __zoomcontrols__: set to `yes` to show Android browser's zoom controls, set to `no` to hide them. Default value is `no`.
|
||||
- __mediaPlaybackRequiresUserAction__: Set to `yes` to prevent HTML5 audio or video from autoplaying (defaults to `no`).
|
||||
- __shouldPauseOnSuspend__: Set to `yes` to make InAppBrowser WebView to pause/resume with the app to stop background audio (this may be required to avoid Google Play issues like described in [CB-11013](https://issues.apache.org/jira/browse/CB-11013)).
|
||||
- __useWideViewPort__: Sets whether the WebView should enable support for the "viewport" HTML meta tag or should use a wide viewport. When the value of the setting is `no`, the layout width is always set to the width of the WebView control in device-independent (CSS) pixels. When the value is `yes` 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. (defaults to `yes`).
|
||||
|
@ -94,6 +94,7 @@ public class InAppBrowser extends CordovaPlugin {
|
||||
private static final String EXIT_EVENT = "exit";
|
||||
private static final String LOCATION = "location";
|
||||
private static final String ZOOM = "zoom";
|
||||
private static final String ZOOMCONTROLS = "zoomcontrols";
|
||||
private static final String HIDDEN = "hidden";
|
||||
private static final String LOAD_START_EVENT = "loadstart";
|
||||
private static final String LOAD_STOP_EVENT = "loadstop";
|
||||
@ -128,7 +129,8 @@ public class InAppBrowser extends CordovaPlugin {
|
||||
private EditText edittext;
|
||||
private CallbackContext callbackContext;
|
||||
private boolean showLocationBar = true;
|
||||
private boolean showZoomControls = true;
|
||||
private boolean enableZoom = true;
|
||||
private boolean showZoomControls = false;
|
||||
private boolean openWindowHidden = false;
|
||||
private boolean clearAllCache = false;
|
||||
private boolean clearSessionCache = false;
|
||||
@ -631,7 +633,8 @@ public class InAppBrowser extends CordovaPlugin {
|
||||
public String showWebPage(final String url, HashMap<String, String> features) {
|
||||
// Determine if we should hide the location bar.
|
||||
showLocationBar = true;
|
||||
showZoomControls = true;
|
||||
enableZoom = true;
|
||||
showZoomControls = false;
|
||||
openWindowHidden = false;
|
||||
mediaPlaybackRequiresUserGesture = false;
|
||||
|
||||
@ -648,7 +651,11 @@ public class InAppBrowser extends CordovaPlugin {
|
||||
}
|
||||
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;
|
||||
}
|
||||
String hidden = features.get(HIDDEN);
|
||||
if (hidden != null) {
|
||||
@ -946,7 +953,8 @@ public class InAppBrowser extends CordovaPlugin {
|
||||
WebSettings settings = inAppWebView.getSettings();
|
||||
settings.setJavaScriptEnabled(true);
|
||||
settings.setJavaScriptCanOpenWindowsAutomatically(true);
|
||||
settings.setBuiltInZoomControls(showZoomControls);
|
||||
settings.setBuiltInZoomControls(enableZoom);
|
||||
settings.setDisplayZoomControls(showZoomControls);
|
||||
settings.setPluginState(android.webkit.WebSettings.PluginState.ON);
|
||||
|
||||
// download event
|
||||
|
Loading…
Reference in New Issue
Block a user