This commit is contained in:
Jesse MacFadyen 2015-03-04 17:42:43 -08:00
commit b96c4a7d9a
2 changed files with 34 additions and 2 deletions

View File

@ -78,6 +78,7 @@ public class InAppBrowser extends CordovaPlugin {
private static final String EXIT_EVENT = "exit";
private static final String LOCATION = "location";
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_STOP_EVENT = "loadstop";
private static final String LOAD_ERROR_EVENT = "loaderror";
@ -89,6 +90,7 @@ public class InAppBrowser extends CordovaPlugin {
private EditText edittext;
private CallbackContext callbackContext;
private boolean showLocationBar = true;
private boolean showZoomControls = true;
private boolean openWindowHidden = false;
private boolean clearAllCache= false;
private boolean clearSessionCache=false;
@ -419,6 +421,15 @@ public class InAppBrowser extends CordovaPlugin {
return this.showLocationBar;
}
/**
* Should we show the zoom controls?
*
* @return boolean
*/
private boolean getShowZoomControls() {
return this.showZoomControls;
}
private InAppBrowser getInAppBrowser(){
return this;
}
@ -432,12 +443,17 @@ public class InAppBrowser extends CordovaPlugin {
public String showWebPage(final String url, HashMap<String, Boolean> features) {
// Determine if we should hide the location bar.
showLocationBar = true;
showZoomControls = true;
openWindowHidden = false;
if (features != null) {
Boolean show = features.get(LOCATION);
if (show != null) {
showLocationBar = show.booleanValue();
}
Boolean zoom = features.get(ZOOM);
if (zoom != null) {
showZoomControls = zoom.booleanValue();
}
Boolean hidden = features.get(HIDDEN);
if (hidden != null) {
openWindowHidden = hidden.booleanValue();
@ -607,7 +623,7 @@ public class InAppBrowser extends CordovaPlugin {
AmazonWebSettings settings = inAppWebView.getSettings();
settings.setJavaScriptEnabled(true);
settings.setJavaScriptCanOpenWindowsAutomatically(true);
settings.setBuiltInZoomControls(true);
settings.setBuiltInZoomControls(getShowZoomControls());
settings.setPluginState(com.amazon.android.webkit.AmazonWebSettings.PluginState.ON);
//Toggle whether this is enabled or not!

View File

@ -75,6 +75,7 @@ public class InAppBrowser extends CordovaPlugin {
// private static final String BLANK = "_blank";
private static final String EXIT_EVENT = "exit";
private static final String LOCATION = "location";
private static final String ZOOM = "zoom";
private static final String HIDDEN = "hidden";
private static final String LOAD_START_EVENT = "loadstart";
private static final String LOAD_STOP_EVENT = "loadstop";
@ -88,6 +89,7 @@ public class InAppBrowser extends CordovaPlugin {
private EditText edittext;
private CallbackContext callbackContext;
private boolean showLocationBar = true;
private boolean showZoomControls = true;
private boolean openWindowHidden = false;
private boolean clearAllCache= false;
private boolean clearSessionCache=false;
@ -453,6 +455,15 @@ public class InAppBrowser extends CordovaPlugin {
return this.showLocationBar;
}
/**
* Should we show the zoom controls?
*
* @return boolean
*/
private boolean getShowZoomControls() {
return this.showZoomControls;
}
private InAppBrowser getInAppBrowser(){
return this;
}
@ -466,12 +477,17 @@ public class InAppBrowser extends CordovaPlugin {
public String showWebPage(final String url, HashMap<String, Boolean> features) {
// Determine if we should hide the location bar.
showLocationBar = true;
showZoomControls = true;
openWindowHidden = false;
if (features != null) {
Boolean show = features.get(LOCATION);
if (show != null) {
showLocationBar = show.booleanValue();
}
Boolean zoom = features.get(ZOOM);
if (zoom != null) {
showZoomControls = zoom.booleanValue();
}
Boolean hidden = features.get(HIDDEN);
if (hidden != null) {
openWindowHidden = hidden.booleanValue();
@ -640,7 +656,7 @@ public class InAppBrowser extends CordovaPlugin {
WebSettings settings = inAppWebView.getSettings();
settings.setJavaScriptEnabled(true);
settings.setJavaScriptCanOpenWindowsAutomatically(true);
settings.setBuiltInZoomControls(true);
settings.setBuiltInZoomControls(getShowZoomControls());
settings.setPluginState(android.webkit.WebSettings.PluginState.ON);
//Toggle whether this is enabled or not!