Return-Path: X-Original-To: apmail-cordova-commits-archive@www.apache.org Delivered-To: apmail-cordova-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 692B3181DE for ; Thu, 18 Jun 2015 22:07:22 +0000 (UTC) Received: (qmail 49797 invoked by uid 500); 18 Jun 2015 22:07:22 -0000 Delivered-To: apmail-cordova-commits-archive@cordova.apache.org Received: (qmail 49771 invoked by uid 500); 18 Jun 2015 22:07:22 -0000 Mailing-List: contact commits-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list commits@cordova.apache.org Received: (qmail 49761 invoked by uid 99); 18 Jun 2015 22:07:22 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 18 Jun 2015 22:07:22 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 32182E3CA6; Thu, 18 Jun 2015 22:07:22 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: purplecabbage@apache.org To: commits@cordova.apache.org Message-Id: <1c97b95ba1ac46bfb87519bb8fdc7206@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: cordova-plugin-inappbrowser git commit: CB-9158 - InAppBrowser zoomControls are always set to true Date: Thu, 18 Jun 2015 22:07:22 +0000 (UTC) Repository: cordova-plugin-inappbrowser Updated Branches: refs/heads/master cb1c6b4d2 -> 74aa099b7 CB-9158 - InAppBrowser zoomControls are always set to true Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/commit/74aa099b Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/tree/74aa099b Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/diff/74aa099b Branch: refs/heads/master Commit: 74aa099b7e69ddc067a46c06e20d593ef5a0874a Parents: cb1c6b4 Author: Anton Antonov Authored: Thu Jun 18 20:28:32 2015 +0300 Committer: Anton Antonov Committed: Thu Jun 18 20:28:32 2015 +0300 ---------------------------------------------------------------------- src/android/InAppBrowser.java | 71 +++++++++++++++++--------------------- 1 file changed, 31 insertions(+), 40 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/blob/74aa099b/src/android/InAppBrowser.java ---------------------------------------------------------------------- diff --git a/src/android/InAppBrowser.java b/src/android/InAppBrowser.java index 217e48e..3ee1853 100644 --- a/src/android/InAppBrowser.java +++ b/src/android/InAppBrowser.java @@ -91,9 +91,9 @@ public class InAppBrowser extends CordovaPlugin { private boolean showLocationBar = true; private boolean showZoomControls = true; private boolean openWindowHidden = false; - private boolean clearAllCache= false; - private boolean clearSessionCache=false; - private boolean hadwareBackButton=true; + private boolean clearAllCache = false; + private boolean clearSessionCache = false; + private boolean hadwareBackButton = true; /** * Executes the request and returns PluginResult. @@ -113,9 +113,9 @@ public class InAppBrowser extends CordovaPlugin { } final String target = t; final HashMap features = parseFeature(args.optString(2)); - + Log.d(LOG_TAG, "target = " + target); - + this.cordova.getActivity().runOnUiThread(new Runnable() { @Override public void run() { @@ -185,7 +185,7 @@ public class InAppBrowser extends CordovaPlugin { Log.d(LOG_TAG, "in blank"); result = showWebPage(url, features); } - + PluginResult pluginResult = new PluginResult(PluginResult.Status.OK, result); pluginResult.setKeepCallback(true); callbackContext.sendPluginResult(pluginResult); @@ -251,9 +251,9 @@ public class InAppBrowser extends CordovaPlugin { */ @Override public void onReset() { - closeDialog(); + closeDialog(); } - + /** * Called by AccelBroker when listener is to be shut down. * Stop listener. @@ -261,7 +261,7 @@ public class InAppBrowser extends CordovaPlugin { public void onDestroy() { closeDialog(); } - + /** * Inject an object (script or style) into the InAppBrowser WebView. * @@ -306,7 +306,7 @@ public class InAppBrowser extends CordovaPlugin { /** * Put the list of features into a hash map - * + * * @param optString * @return */ @@ -348,7 +348,7 @@ public class InAppBrowser extends CordovaPlugin { } else { intent.setData(uri); } - intent.putExtra(Browser.EXTRA_APPLICATION_ID, cordova.getActivity().getPackageName()); + intent.putExtra(Browser.EXTRA_APPLICATION_ID, cordova.getActivity().getPackageName()); this.cordova.getActivity().startActivity(intent); return ""; } catch (android.content.ActivityNotFoundException e) { @@ -373,12 +373,12 @@ public class InAppBrowser extends CordovaPlugin { childView.setWebViewClient(new WebViewClient() { // NB: wait for about:blank before dismissing public void onPageFinished(WebView view, String url) { - if (dialog != null) { - dialog.dismiss(); - } - } - }); - // NB: From SDK 19: "If you call methods on WebView from any thread + if (dialog != null) { + dialog.dismiss(); + } + } + }); + // NB: From SDK 19: "If you call methods on WebView from any thread // other than your app's UI thread, it can cause unexpected results." // http://developer.android.com/guide/webapps/migrating.html#Threads childView.loadUrl("about:blank"); @@ -455,15 +455,6 @@ 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; } @@ -487,7 +478,7 @@ public class InAppBrowser extends CordovaPlugin { Boolean zoom = features.get(ZOOM); if (zoom != null) { showZoomControls = zoom.booleanValue(); - } + } Boolean hidden = features.get(HIDDEN); if (hidden != null) { openWindowHidden = hidden.booleanValue(); @@ -506,7 +497,7 @@ public class InAppBrowser extends CordovaPlugin { } } } - + final CordovaWebView thatWebView = this.webView; // Create dialog in new thread @@ -540,7 +531,7 @@ public class InAppBrowser extends CordovaPlugin { // Toolbar layout RelativeLayout toolbar = new RelativeLayout(cordova.getActivity()); - //Please, no more black! + //Please, no more black! toolbar.setBackgroundColor(android.graphics.Color.LTGRAY); toolbar.setLayoutParams(new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, this.dpToPixels(44))); toolbar.setPadding(this.dpToPixels(2), this.dpToPixels(2), this.dpToPixels(2), this.dpToPixels(2)); @@ -656,7 +647,7 @@ public class InAppBrowser extends CordovaPlugin { WebSettings settings = inAppWebView.getSettings(); settings.setJavaScriptEnabled(true); settings.setJavaScriptCanOpenWindowsAutomatically(true); - settings.setBuiltInZoomControls(getShowZoomControls()); + settings.setBuiltInZoomControls(showZoomControls); settings.setPluginState(android.webkit.WebSettings.PluginState.ON); //Toggle whether this is enabled or not! @@ -733,7 +724,7 @@ public class InAppBrowser extends CordovaPlugin { * * @param obj a JSONObject contain event payload information * @param status the status code to return to the JavaScript environment - */ + */ private void sendUpdate(JSONObject obj, boolean keepCallback, PluginResult.Status status) { if (callbackContext != null) { PluginResult result = new PluginResult(status, obj); @@ -744,7 +735,7 @@ public class InAppBrowser extends CordovaPlugin { } } } - + /** * The webview client receives notifications about appView */ @@ -775,7 +766,7 @@ public class InAppBrowser extends CordovaPlugin { String newloc = ""; if (url.startsWith("http:") || url.startsWith("https:") || url.startsWith("file:")) { newloc = url; - } + } // If dialing phone (tel:5551212) else if (url.startsWith(WebView.SCHEME_TEL)) { try { @@ -839,37 +830,37 @@ public class InAppBrowser extends CordovaPlugin { JSONObject obj = new JSONObject(); obj.put("type", LOAD_START_EVENT); obj.put("url", newloc); - + sendUpdate(obj, true); } catch (JSONException ex) { Log.d(LOG_TAG, "Should never happen"); } } - + public void onPageFinished(WebView view, String url) { super.onPageFinished(view, url); - + try { JSONObject obj = new JSONObject(); obj.put("type", LOAD_STOP_EVENT); obj.put("url", url); - + sendUpdate(obj, true); } catch (JSONException ex) { Log.d(LOG_TAG, "Should never happen"); } } - + public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) { super.onReceivedError(view, errorCode, description, failingUrl); - + try { JSONObject obj = new JSONObject(); obj.put("type", LOAD_ERROR_EVENT); obj.put("url", failingUrl); obj.put("code", errorCode); obj.put("message", description); - + sendUpdate(obj, true, PluginResult.Status.ERROR); } catch (JSONException ex) { Log.d(LOG_TAG, "Should never happen"); --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org For additional commands, e-mail: commits-help@cordova.apache.org