Skip to content

Commit

Permalink
CB-2459: Customize InAppBrowser location bar
Browse files Browse the repository at this point in the history
  • Loading branch information
macdonst committed Mar 10, 2013
1 parent ce1a961 commit e0d0d6c
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions framework/src/org/apache/cordova/InAppBrowser.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,15 @@ public class InAppBrowser extends CordovaPlugin {
private static final String EXIT_EVENT = "exit";
private static final String LOAD_START_EVENT = "loadstart";
private static final String LOAD_STOP_EVENT = "loadstop";
private static final String CLOSE_BUTTON_CAPTION = "closebuttoncaption";
private long MAX_QUOTA = 100 * 1024 * 1024;

private Dialog dialog;
private WebView inAppWebView;
private EditText edittext;
private boolean showLocationBar = true;
private CallbackContext callbackContext;
private String buttonLabel = "Done";

/**
* Executes the request and returns PluginResult.
Expand Down Expand Up @@ -177,8 +179,12 @@ private HashMap<String, Boolean> parseFeature(String optString) {
option = new StringTokenizer(features.nextToken(), "=");
if (option.hasMoreElements()) {
String key = option.nextToken();
Boolean value = option.nextToken().equals("no") ? Boolean.FALSE : Boolean.TRUE;
map.put(key, value);
if (key.equalsIgnoreCase(CLOSE_BUTTON_CAPTION)) {
this.buttonLabel = option.nextToken();
} else {
Boolean value = option.nextToken().equals("no") ? Boolean.FALSE : Boolean.TRUE;
map.put(key, value);
}
}
}
return map;
Expand Down Expand Up @@ -292,7 +298,10 @@ public String showWebPage(final String url, HashMap<String, Boolean> features) {
// Determine if we should hide the location bar.
showLocationBar = true;
if (features != null) {
showLocationBar = features.get(LOCATION).booleanValue();
Boolean show = features.get(LOCATION);
if (show != null) {
showLocationBar = show.booleanValue();
}
}

final CordovaWebView thatWebView = this.webView;
Expand Down Expand Up @@ -408,7 +417,7 @@ public boolean onKey(View v, int keyCode, KeyEvent event) {
close.setLayoutParams(closeLayoutParams);
forward.setContentDescription("Close Button");
close.setId(5);
close.setText("Done");
close.setText(buttonLabel);
close.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
closeDialog();
Expand Down

0 comments on commit e0d0d6c

Please sign in to comment.