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 62A8D103E7 for ; Wed, 10 Jul 2013 21:32:29 +0000 (UTC) Received: (qmail 47760 invoked by uid 500); 10 Jul 2013 21:32:29 -0000 Delivered-To: apmail-cordova-commits-archive@cordova.apache.org Received: (qmail 47741 invoked by uid 500); 10 Jul 2013 21:32:29 -0000 Mailing-List: contact commits-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cordova.apache.org Delivered-To: mailing list commits@cordova.apache.org Received: (qmail 47734 invoked by uid 99); 10 Jul 2013 21:32:29 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 10 Jul 2013 21:32:29 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id F23C788C8BB; Wed, 10 Jul 2013 21:32:28 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: maxw@apache.org To: commits@cordova.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: android commit: [CB-4103] Made config parameters case-insensitive. Date: Wed, 10 Jul 2013 21:32:28 +0000 (UTC) Updated Branches: refs/heads/2.9.x 7cde444ff -> 1167da202 [CB-4103] Made config parameters case-insensitive. For consistency with other platforms (and for readability), UpperCamelCasing is used by default in the code. Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/1167da20 Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/1167da20 Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/1167da20 Branch: refs/heads/2.9.x Commit: 1167da2027d794ff0e4fb06db90979b38b9dd38b Parents: 7cde444 Author: Max Woghiren Authored: Wed Jul 10 17:27:13 2013 -0400 Committer: Max Woghiren Committed: Wed Jul 10 17:32:12 2013 -0400 ---------------------------------------------------------------------- framework/src/org/apache/cordova/Config.java | 17 +++++----- .../src/org/apache/cordova/CordovaActivity.java | 33 +++++++++++--------- 2 files changed, 28 insertions(+), 22 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-android/blob/1167da20/framework/src/org/apache/cordova/Config.java ---------------------------------------------------------------------- diff --git a/framework/src/org/apache/cordova/Config.java b/framework/src/org/apache/cordova/Config.java index 6a041cf..3ef35a5 100644 --- a/framework/src/org/apache/cordova/Config.java +++ b/framework/src/org/apache/cordova/Config.java @@ -24,6 +24,7 @@ import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; +import java.util.Locale; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -102,7 +103,7 @@ public class Config { } } else if (strNode.equals("preference")) { - String name = xml.getAttributeValue(null, "name"); + String name = xml.getAttributeValue(null, "name").toLowerCase(Locale.getDefault()); /* Java 1.6 does not support switch-based strings Java 7 does, but we're using Dalvik, which is apparently not Java. Since we're reading XML, this has to be an ugly if/else. @@ -112,10 +113,10 @@ public class Config { Note: We should probably pass in the classname for the variable splash on splashscreen! */ - if (name.equals("loglevel")) { + if (name.equalsIgnoreCase("LogLevel")) { String level = xml.getAttributeValue(null, "value"); LOG.setLogLevel(level); - } else if (name.equals("splashscreen")) { + } else if (name.equalsIgnoreCase("SplashScreen")) { String value = xml.getAttributeValue(null, "value"); int resource = 0; if (value == null) @@ -126,25 +127,25 @@ public class Config { action.getIntent().putExtra(name, resource); } - else if(name.equals("backgroundColor")) { + else if(name.equalsIgnoreCase("BackgroundColor")) { int value = xml.getAttributeIntValue(null, "value", Color.BLACK); action.getIntent().putExtra(name, value); } - else if(name.equals("loadUrlTimeoutValue")) { + else if(name.equalsIgnoreCase("LoadUrlTimeoutValue")) { int value = xml.getAttributeIntValue(null, "value", 20000); action.getIntent().putExtra(name, value); } - else if(name.equals("keepRunning")) + else if(name.equalsIgnoreCase("KeepRunning")) { boolean value = xml.getAttributeValue(null, "value").equals("true"); action.getIntent().putExtra(name, value); } - else if(name.equals("InAppBrowserStorageEnabled")) + else if(name.equalsIgnoreCase("InAppBrowserStorageEnabled")) { boolean value = xml.getAttributeValue(null, "value").equals("true"); action.getIntent().putExtra(name, value); } - else if(name.equals("disallowOverscroll")) + else if(name.equalsIgnoreCase("DisallowOverscroll")) { boolean value = xml.getAttributeValue(null, "value").equals("true"); action.getIntent().putExtra(name, value); http://git-wip-us.apache.org/repos/asf/cordova-android/blob/1167da20/framework/src/org/apache/cordova/CordovaActivity.java ---------------------------------------------------------------------- diff --git a/framework/src/org/apache/cordova/CordovaActivity.java b/framework/src/org/apache/cordova/CordovaActivity.java index a68e546..95cb2f1 100755 --- a/framework/src/org/apache/cordova/CordovaActivity.java +++ b/framework/src/org/apache/cordova/CordovaActivity.java @@ -19,6 +19,7 @@ package org.apache.cordova; import java.util.HashMap; +import java.util.Locale; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; @@ -281,12 +282,12 @@ public class CordovaActivity extends Activity implements CordovaInterface { initCallbackClass = savedInstanceState.getString("callbackClass"); } - if(!this.getBooleanProperty("showTitle", false)) + if(!this.getBooleanProperty("ShowTitle", false)) { getWindow().requestFeature(Window.FEATURE_NO_TITLE); } - if(this.getBooleanProperty("setFullscreen", false)) + if(this.getBooleanProperty("SetFullscreen", false)) { getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); @@ -362,7 +363,7 @@ public class CordovaActivity extends Activity implements CordovaInterface { ViewGroup.LayoutParams.MATCH_PARENT, 1.0F)); - if (this.getBooleanProperty("disallowOverscroll", false)) { + if (this.getBooleanProperty("DisallowOverscroll", false)) { if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.GINGERBREAD) { this.appView.setOverScrollMode(CordovaWebView.OVER_SCROLL_NEVER); } @@ -391,11 +392,11 @@ public class CordovaActivity extends Activity implements CordovaInterface { } // Set backgroundColor - this.backgroundColor = this.getIntegerProperty("backgroundColor", Color.BLACK); + this.backgroundColor = this.getIntegerProperty("BackgroundColor", Color.BLACK); this.root.setBackgroundColor(this.backgroundColor); // If keepRunning - this.keepRunning = this.getBooleanProperty("keepRunning", true); + this.keepRunning = this.getBooleanProperty("KeepRunning", true); // Then load the spinner this.loadSpinner(); @@ -411,10 +412,10 @@ public class CordovaActivity extends Activity implements CordovaInterface { // If loadingDialog property, then show the App loading dialog for first page of app String loading = null; if ((this.appView == null) || !this.appView.canGoBack()) { - loading = this.getStringProperty("loadingDialog", null); + loading = this.getStringProperty("LoadingDialog", null); } else { - loading = this.getStringProperty("loadingPageDialog", null); + loading = this.getStringProperty("LoadingPageDialog", null); } if (loading != null) { @@ -451,7 +452,7 @@ public class CordovaActivity extends Activity implements CordovaInterface { } this.splashscreenTime = time; - this.splashscreen = this.getIntegerProperty("splashscreen", 0); + this.splashscreen = this.getIntegerProperty("SplashScreen", 0); this.showSplashScreen(this.splashscreenTime); this.appView.loadUrl(url, time); } @@ -517,6 +518,7 @@ public class CordovaActivity extends Activity implements CordovaInterface { if (bundle == null) { return defaultValue; } + name = name.toLowerCase(Locale.getDefault()); Boolean p; try { p = (Boolean) bundle.get(name); @@ -547,6 +549,7 @@ public class CordovaActivity extends Activity implements CordovaInterface { if (bundle == null) { return defaultValue; } + name = name.toLowerCase(Locale.getDefault()); Integer p; try { p = (Integer) bundle.get(name); @@ -571,6 +574,7 @@ public class CordovaActivity extends Activity implements CordovaInterface { if (bundle == null) { return defaultValue; } + name = name.toLowerCase(Locale.getDefault()); String p = bundle.getString(name); if (p == null) { return defaultValue; @@ -590,6 +594,7 @@ public class CordovaActivity extends Activity implements CordovaInterface { if (bundle == null) { return defaultValue; } + name = name.toLowerCase(Locale.getDefault()); Double p; try { p = (Double) bundle.get(name); @@ -610,7 +615,7 @@ public class CordovaActivity extends Activity implements CordovaInterface { */ public void setBooleanProperty(String name, boolean value) { Log.d(TAG, "Setting boolean properties in CordovaActivity will be deprecated in 3.0 on July 2013, please use config.xml"); - this.getIntent().putExtra(name, value); + this.getIntent().putExtra(name.toLowerCase(), value); } /** @@ -621,7 +626,7 @@ public class CordovaActivity extends Activity implements CordovaInterface { */ public void setIntegerProperty(String name, int value) { Log.d(TAG, "Setting integer properties in CordovaActivity will be deprecated in 3.0 on July 2013, please use config.xml"); - this.getIntent().putExtra(name, value); + this.getIntent().putExtra(name.toLowerCase(), value); } /** @@ -632,7 +637,7 @@ public class CordovaActivity extends Activity implements CordovaInterface { */ public void setStringProperty(String name, String value) { Log.d(TAG, "Setting string properties in CordovaActivity will be deprecated in 3.0 on July 2013, please use config.xml"); - this.getIntent().putExtra(name, value); + this.getIntent().putExtra(name.toLowerCase(), value); } /** @@ -643,7 +648,7 @@ public class CordovaActivity extends Activity implements CordovaInterface { */ public void setDoubleProperty(String name, double value) { Log.d(TAG, "Setting double properties in CordovaActivity will be deprecated in 3.0 on July 2013, please use config.xml"); - this.getIntent().putExtra(name, value); + this.getIntent().putExtra(name.toLowerCase(), value); } @Override @@ -696,7 +701,7 @@ public class CordovaActivity extends Activity implements CordovaInterface { //Code to test CB-3064 - String errorUrl = this.getStringProperty("errorUrl", null); + String errorUrl = this.getStringProperty("ErrorUrl", null); LOG.d(TAG, "CB-3064: The errorUrl is " + errorUrl); if (this.activityState == ACTIVITY_STARTING) { @@ -1121,7 +1126,7 @@ public class CordovaActivity extends Activity implements CordovaInterface { else { // If the splash dialog is showing don't try to show it again if (this.splashDialog == null || !this.splashDialog.isShowing()) { - this.splashscreen = this.getIntegerProperty("splashscreen", 0); + this.splashscreen = this.getIntegerProperty("SplashScreen", 0); this.showSplashScreen(this.splashscreenTime); } }