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 CD70810FEA for ; Tue, 11 Jun 2013 00:15:17 +0000 (UTC) Received: (qmail 60120 invoked by uid 500); 11 Jun 2013 00:15:17 -0000 Delivered-To: apmail-cordova-commits-archive@cordova.apache.org Received: (qmail 59869 invoked by uid 500); 11 Jun 2013 00:15:17 -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 59386 invoked by uid 99); 11 Jun 2013 00:15:16 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 11 Jun 2013 00:15:16 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id B17168A302E; Tue, 11 Jun 2013 00:15:16 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: steven@apache.org To: commits@cordova.apache.org Date: Tue, 11 Jun 2013 00:15:46 -0000 Message-Id: <3429850e283a4bfb9e16843f86faa2e0@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [31/32] android commit: CB-3736: Cleaning up code so that this makes more sense. Variables are OK 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/3.0.0 Commit: e52d4fc0035546c6bbd93a60f02bd887fddab7cc Parents: 3753e3f Author: Joe Bowser Authored: Fri Jun 7 16:43:53 2013 -0700 Committer: Joe Bowser Committed: Fri Jun 7 16:43:53 2013 -0700 ---------------------------------------------------------------------- framework/src/org/apache/cordova/Globalization.java | 13 +++++++------ 1 file 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)){