Updated Branches: refs/heads/master 3753e3f35 -> e52d4fc00
CB-3736: Cleaning up code so that this makes more sense. Variables are OK Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/e52d4fc0 Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/e52d4fc0 Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/e52d4fc0 Branch: refs/heads/master Commit: e52d4fc0035546c6bbd93a60f02bd887fddab7cc Parents: 3753e3f Author: Joe Bowser <[email protected]> Authored: Fri Jun 7 16:43:53 2013 -0700 Committer: Joe Bowser <[email protected]> Committed: Fri Jun 7 16:43:53 2013 -0700 ---------------------------------------------------------------------- .../src/org/apache/cordova/Globalization.java | 13 +++++++------ 1 files changed, 7 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-android/blob/e52d4fc0/framework/src/org/apache/cordova/Globalization.java ---------------------------------------------------------------------- diff --git a/framework/src/org/apache/cordova/Globalization.java b/framework/src/org/apache/cordova/Globalization.java index 5c75e10..4fac074 100644 --- a/framework/src/org/apache/cordova/Globalization.java +++ b/framework/src/org/apache/cordova/Globalization.java @@ -260,12 +260,13 @@ public class Globalization extends CordovaPlugin { String fmt = fmtDate.toLocalizedPattern() + " " + fmtTime.toLocalizedPattern(); //default SHORT date/time format. ex. dd/MM/yyyy h:mm a //get Date value + options (if available) - if (options.getJSONObject(0).length() > 1){ + boolean test = options.getJSONObject(0).has(OPTIONS); + if (options.getJSONObject(0).has(OPTIONS)){ //options were included - + JSONObject innerOptions = options.getJSONObject(0).getJSONObject(OPTIONS); //get formatLength option - if (!((JSONObject)options.getJSONObject(0).get(OPTIONS)).isNull(FORMATLENGTH)){ - String fmtOpt = (String)((JSONObject)options.getJSONObject(0).get(OPTIONS)).get(FORMATLENGTH); + if (!innerOptions.isNull(FORMATLENGTH)){ + String fmtOpt = innerOptions.getString(FORMATLENGTH); if (fmtOpt.equalsIgnoreCase(MEDIUM)){//medium fmtDate = (SimpleDateFormat)android.text.format.DateFormat.getMediumDateFormat(this.cordova.getActivity()); }else if (fmtOpt.equalsIgnoreCase(LONG) || fmtOpt.equalsIgnoreCase(FULL)){ //long/full @@ -275,8 +276,8 @@ public class Globalization extends CordovaPlugin { //return pattern type fmt = fmtDate.toLocalizedPattern() + " " + fmtTime.toLocalizedPattern(); - if (!((JSONObject)options.getJSONObject(0).get(OPTIONS)).isNull(SELECTOR)){ - String selOpt = (String)((JSONObject)options.getJSONObject(0).get(OPTIONS)).get(SELECTOR); + if (!innerOptions.isNull(SELECTOR)){ + String selOpt = innerOptions.getString(SELECTOR); if (selOpt.equalsIgnoreCase(DATE)){ fmt = fmtDate.toLocalizedPattern(); }else if (selOpt.equalsIgnoreCase(TIME)){
