You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by Filip Maj <fi...@adobe.com> on 2013/06/08 20:23:20 UTC

Re: android commit: CB-3736: Cleaning up code so that this makes more sense. Variables are OK

I feel like the police here.. remember to also make changes to the plugin
repos if you are changing plugin code :)

On 13-06-07 4:44 PM, "bowserj@apache.org" <bo...@apache.org> wrote:

>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 <bo...@apache.org>
>Authored: Fri Jun 7 16:43:53 2013 -0700
>Committer: Joe Bowser <bo...@apache.org>
>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/frame
>work/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(FORMATLENG
>TH);
>+                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)){
>


Re: android commit: CB-3736: Cleaning up code so that this makes more sense. Variables are OK

Posted by Filip Maj <fi...@adobe.com>.
Thanks Joe!

On 13-06-08 12:06 PM, "Joe Bowser" <bo...@gmail.com> wrote:

>Will do that on Monday
>On Jun 8, 2013 11:23 AM, "Filip Maj" <fi...@adobe.com> wrote:
>
>> I feel like the police here.. remember to also make changes to the
>>plugin
>> repos if you are changing plugin code :)
>>
>> On 13-06-07 4:44 PM, "bowserj@apache.org" <bo...@apache.org> wrote:
>>
>> >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 <bo...@apache.org>
>> >Authored: Fri Jun 7 16:43:53 2013 -0700
>> >Committer: Joe Bowser <bo...@apache.org>
>> >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/fram
>>e
>> >work/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(FORMATLENGT
>>>H)
>> >){
>> >-                    String fmtOpt =
>> 
>>>(String)((JSONObject)options.getJSONObject(0).get(OPTIONS)).get(FORMATLE
>>>NG
>> >TH);
>> >+                if (!innerOptions.isNull(FORMATLENGTH)){
>> >+                    String fmtOpt =
>>innerOptions.getString(FORMATLENGTH);
>> >                     if (fmtOpt.equalsIgnoreCase(MEDIUM)){//medium
>> >                         fmtDate =
>> 
>>>(SimpleDateFormat)android.text.format.DateFormat.getMediumDateFormat(thi
>>>s.
>> >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)){
>> >
>>
>>


Re: android commit: CB-3736: Cleaning up code so that this makes more sense. Variables are OK

Posted by Joe Bowser <bo...@gmail.com>.
Will do that on Monday
On Jun 8, 2013 11:23 AM, "Filip Maj" <fi...@adobe.com> wrote:

> I feel like the police here.. remember to also make changes to the plugin
> repos if you are changing plugin code :)
>
> On 13-06-07 4:44 PM, "bowserj@apache.org" <bo...@apache.org> wrote:
>
> >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 <bo...@apache.org>
> >Authored: Fri Jun 7 16:43:53 2013 -0700
> >Committer: Joe Bowser <bo...@apache.org>
> >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/frame
> >work/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(FORMATLENG
> >TH);
> >+                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)){
> >
>
>