Added option to disable/enable zoom controls
This change supports Android and Amazon Fire OS
This commit is contained in:
parent
f90e571430
commit
720123718e
@ -78,6 +78,7 @@ public class InAppBrowser extends CordovaPlugin {
|
|||||||
private static final String EXIT_EVENT = "exit";
|
private static final String EXIT_EVENT = "exit";
|
||||||
private static final String LOCATION = "location";
|
private static final String LOCATION = "location";
|
||||||
private static final String HIDDEN = "hidden";
|
private static final String HIDDEN = "hidden";
|
||||||
|
private static final String ZOOM = "zoom";
|
||||||
private static final String LOAD_START_EVENT = "loadstart";
|
private static final String LOAD_START_EVENT = "loadstart";
|
||||||
private static final String LOAD_STOP_EVENT = "loadstop";
|
private static final String LOAD_STOP_EVENT = "loadstop";
|
||||||
private static final String LOAD_ERROR_EVENT = "loaderror";
|
private static final String LOAD_ERROR_EVENT = "loaderror";
|
||||||
@ -90,6 +91,7 @@ public class InAppBrowser extends CordovaPlugin {
|
|||||||
private EditText edittext;
|
private EditText edittext;
|
||||||
private CallbackContext callbackContext;
|
private CallbackContext callbackContext;
|
||||||
private boolean showLocationBar = true;
|
private boolean showLocationBar = true;
|
||||||
|
private boolean showZoomControls = true;
|
||||||
private boolean openWindowHidden = false;
|
private boolean openWindowHidden = false;
|
||||||
private String buttonLabel = "Done";
|
private String buttonLabel = "Done";
|
||||||
private boolean clearAllCache= false;
|
private boolean clearAllCache= false;
|
||||||
@ -422,6 +424,15 @@ public class InAppBrowser extends CordovaPlugin {
|
|||||||
return this.showLocationBar;
|
return this.showLocationBar;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Should we show the zoom controls?
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
private boolean getShowZoomControls() {
|
||||||
|
return this.showZoomControls;
|
||||||
|
}
|
||||||
|
|
||||||
private InAppBrowser getInAppBrowser(){
|
private InAppBrowser getInAppBrowser(){
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
@ -435,12 +446,17 @@ public class InAppBrowser extends CordovaPlugin {
|
|||||||
public String showWebPage(final String url, HashMap<String, Boolean> features) {
|
public String showWebPage(final String url, HashMap<String, Boolean> features) {
|
||||||
// Determine if we should hide the location bar.
|
// Determine if we should hide the location bar.
|
||||||
showLocationBar = true;
|
showLocationBar = true;
|
||||||
|
showZoomControls = true;
|
||||||
openWindowHidden = false;
|
openWindowHidden = false;
|
||||||
if (features != null) {
|
if (features != null) {
|
||||||
Boolean show = features.get(LOCATION);
|
Boolean show = features.get(LOCATION);
|
||||||
if (show != null) {
|
if (show != null) {
|
||||||
showLocationBar = show.booleanValue();
|
showLocationBar = show.booleanValue();
|
||||||
}
|
}
|
||||||
|
Boolean zoom = features.get(ZOOM);
|
||||||
|
if (zoom != null) {
|
||||||
|
showZoomControls = zoom.booleanValue();
|
||||||
|
}
|
||||||
Boolean hidden = features.get(HIDDEN);
|
Boolean hidden = features.get(HIDDEN);
|
||||||
if (hidden != null) {
|
if (hidden != null) {
|
||||||
openWindowHidden = hidden.booleanValue();
|
openWindowHidden = hidden.booleanValue();
|
||||||
@ -614,7 +630,7 @@ public class InAppBrowser extends CordovaPlugin {
|
|||||||
AmazonWebSettings settings = inAppWebView.getSettings();
|
AmazonWebSettings settings = inAppWebView.getSettings();
|
||||||
settings.setJavaScriptEnabled(true);
|
settings.setJavaScriptEnabled(true);
|
||||||
settings.setJavaScriptCanOpenWindowsAutomatically(true);
|
settings.setJavaScriptCanOpenWindowsAutomatically(true);
|
||||||
settings.setBuiltInZoomControls(true);
|
settings.setBuiltInZoomControls(getShowZoomControls());
|
||||||
settings.setPluginState(com.amazon.android.webkit.AmazonWebSettings.PluginState.ON);
|
settings.setPluginState(com.amazon.android.webkit.AmazonWebSettings.PluginState.ON);
|
||||||
|
|
||||||
//Toggle whether this is enabled or not!
|
//Toggle whether this is enabled or not!
|
||||||
|
@ -71,6 +71,7 @@ public class InAppBrowser extends CordovaPlugin {
|
|||||||
// private static final String BLANK = "_blank";
|
// private static final String BLANK = "_blank";
|
||||||
private static final String EXIT_EVENT = "exit";
|
private static final String EXIT_EVENT = "exit";
|
||||||
private static final String LOCATION = "location";
|
private static final String LOCATION = "location";
|
||||||
|
private static final String ZOOM = "zoom";
|
||||||
private static final String HIDDEN = "hidden";
|
private static final String HIDDEN = "hidden";
|
||||||
private static final String LOAD_START_EVENT = "loadstart";
|
private static final String LOAD_START_EVENT = "loadstart";
|
||||||
private static final String LOAD_STOP_EVENT = "loadstop";
|
private static final String LOAD_STOP_EVENT = "loadstop";
|
||||||
@ -84,6 +85,7 @@ public class InAppBrowser extends CordovaPlugin {
|
|||||||
private EditText edittext;
|
private EditText edittext;
|
||||||
private CallbackContext callbackContext;
|
private CallbackContext callbackContext;
|
||||||
private boolean showLocationBar = true;
|
private boolean showLocationBar = true;
|
||||||
|
private boolean showZoomControls = true;
|
||||||
private boolean openWindowHidden = false;
|
private boolean openWindowHidden = false;
|
||||||
private String buttonLabel = "Done";
|
private String buttonLabel = "Done";
|
||||||
private boolean clearAllCache= false;
|
private boolean clearAllCache= false;
|
||||||
@ -408,6 +410,15 @@ public class InAppBrowser extends CordovaPlugin {
|
|||||||
return this.showLocationBar;
|
return this.showLocationBar;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Should we show the zoom controls?
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
private boolean getShowZoomControls() {
|
||||||
|
return this.showZoomControls;
|
||||||
|
}
|
||||||
|
|
||||||
private InAppBrowser getInAppBrowser(){
|
private InAppBrowser getInAppBrowser(){
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
@ -421,12 +432,17 @@ public class InAppBrowser extends CordovaPlugin {
|
|||||||
public String showWebPage(final String url, HashMap<String, Boolean> features) {
|
public String showWebPage(final String url, HashMap<String, Boolean> features) {
|
||||||
// Determine if we should hide the location bar.
|
// Determine if we should hide the location bar.
|
||||||
showLocationBar = true;
|
showLocationBar = true;
|
||||||
|
showZoomControls = true;
|
||||||
openWindowHidden = false;
|
openWindowHidden = false;
|
||||||
if (features != null) {
|
if (features != null) {
|
||||||
Boolean show = features.get(LOCATION);
|
Boolean show = features.get(LOCATION);
|
||||||
if (show != null) {
|
if (show != null) {
|
||||||
showLocationBar = show.booleanValue();
|
showLocationBar = show.booleanValue();
|
||||||
}
|
}
|
||||||
|
Boolean zoom = features.get(ZOOM);
|
||||||
|
if (zoom != null) {
|
||||||
|
showZoomControls = zoom.booleanValue();
|
||||||
|
}
|
||||||
Boolean hidden = features.get(HIDDEN);
|
Boolean hidden = features.get(HIDDEN);
|
||||||
if (hidden != null) {
|
if (hidden != null) {
|
||||||
openWindowHidden = hidden.booleanValue();
|
openWindowHidden = hidden.booleanValue();
|
||||||
@ -595,7 +611,7 @@ public class InAppBrowser extends CordovaPlugin {
|
|||||||
WebSettings settings = inAppWebView.getSettings();
|
WebSettings settings = inAppWebView.getSettings();
|
||||||
settings.setJavaScriptEnabled(true);
|
settings.setJavaScriptEnabled(true);
|
||||||
settings.setJavaScriptCanOpenWindowsAutomatically(true);
|
settings.setJavaScriptCanOpenWindowsAutomatically(true);
|
||||||
settings.setBuiltInZoomControls(true);
|
settings.setBuiltInZoomControls(getShowZoomControls());
|
||||||
settings.setPluginState(android.webkit.WebSettings.PluginState.ON);
|
settings.setPluginState(android.webkit.WebSettings.PluginState.ON);
|
||||||
|
|
||||||
//Toggle whether this is enabled or not!
|
//Toggle whether this is enabled or not!
|
||||||
|
Loading…
Reference in New Issue
Block a user