From ed94d0dd30831810eeb8c28523d08934c521ae00 Mon Sep 17 00:00:00 2001 From: William Quast Date: Tue, 29 May 2012 18:59:31 -0500 Subject: [PATCH 1/4] Make PluginResult return valid JSON so the JS side can use JSON.parse --- framework/src/org/apache/cordova/api/PluginResult.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework/src/org/apache/cordova/api/PluginResult.java b/framework/src/org/apache/cordova/api/PluginResult.java index c3ef6d6a..73efab9a 100755 --- a/framework/src/org/apache/cordova/api/PluginResult.java +++ b/framework/src/org/apache/cordova/api/PluginResult.java @@ -80,7 +80,7 @@ public class PluginResult { } public String getJSONString() { - return "{status:" + this.status + ",message:" + this.message + ",keepCallback:" + this.keepCallback + "}"; + return "{\"status\":" + this.status + ",\"message\":" + this.message + ",\"keepCallback\":" + this.keepCallback + "}"; } public String toSuccessCallbackString(String callbackId) { From c21e8c9c87feea7d81779f6c12d92de0a0f857f7 Mon Sep 17 00:00:00 2001 From: macdonst Date: Wed, 30 May 2012 21:07:56 -0400 Subject: [PATCH 2/4] CB-849: Cannot search by birthday --- .../org/apache/cordova/ContactAccessor.java | 191 +++++++++--------- .../apache/cordova/ContactAccessorSdk5.java | 27 ++- 2 files changed, 117 insertions(+), 101 deletions(-) diff --git a/framework/src/org/apache/cordova/ContactAccessor.java b/framework/src/org/apache/cordova/ContactAccessor.java index 12669ce4..d2bf66c8 100644 --- a/framework/src/org/apache/cordova/ContactAccessor.java +++ b/framework/src/org/apache/cordova/ContactAccessor.java @@ -18,7 +18,6 @@ package org.apache.cordova; import java.util.HashMap; -import android.app.Activity; import android.content.Context; import android.util.Log; import android.webkit.WebView; @@ -48,21 +47,21 @@ public abstract class ContactAccessor { * @return true if the key data is required */ protected boolean isRequired(String key, HashMap map) { - Boolean retVal = map.get(key); - return (retVal == null) ? false : retVal.booleanValue(); - } + Boolean retVal = map.get(key); + return (retVal == null) ? false : retVal.booleanValue(); + } /** * Create a hash map of what data needs to be populated in the Contact object * @param fields the list of fields to populate * @return the hash map of required data */ - protected HashMap buildPopulationSet(JSONArray fields) { - HashMap map = new HashMap(); + protected HashMap buildPopulationSet(JSONArray fields) { + HashMap map = new HashMap(); - String key; - try { - if (fields.length() == 1 && fields.getString(0).equals("*")) { + String key; + try { + if (fields.length() == 1 && fields.getString(0).equals("*")) { map.put("displayName", true); map.put("name", true); map.put("nickname", true); @@ -76,90 +75,90 @@ public abstract class ContactAccessor { map.put("urls", true); map.put("photos", true); map.put("categories", true); - } - else { - for (int i=0; i Date: Sat, 2 Jun 2012 11:12:12 -0400 Subject: [PATCH 3/4] Change 'websites' to 'urls' --- framework/src/org/apache/cordova/ContactAccessorSdk5.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework/src/org/apache/cordova/ContactAccessorSdk5.java b/framework/src/org/apache/cordova/ContactAccessorSdk5.java index 9e672e93..02047e8c 100644 --- a/framework/src/org/apache/cordova/ContactAccessorSdk5.java +++ b/framework/src/org/apache/cordova/ContactAccessorSdk5.java @@ -1166,7 +1166,7 @@ public class ContactAccessorSdk5 extends ContactAccessor { // Modify urls JSONArray websites = null; try { - websites = contact.getJSONArray("websites"); + websites = contact.getJSONArray("urls"); if (websites != null) { for (int i=0; i Date: Mon, 4 Jun 2012 16:21:13 -0400 Subject: [PATCH 4/4] Cb-858: Media record defaults to sdcard which may not be mounted --- .../src/org/apache/cordova/AudioPlayer.java | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/framework/src/org/apache/cordova/AudioPlayer.java b/framework/src/org/apache/cordova/AudioPlayer.java index 35b408a4..9397ec74 100755 --- a/framework/src/org/apache/cordova/AudioPlayer.java +++ b/framework/src/org/apache/cordova/AudioPlayer.java @@ -85,7 +85,11 @@ public class AudioPlayer implements OnCompletionListener, OnPreparedListener, On public AudioPlayer(AudioHandler handler, String id) { this.handler = handler; this.id = id; - this.tempFile = Environment.getExternalStorageDirectory().getAbsolutePath() + "/tmprecording.mp3"; + if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) { + this.tempFile = Environment.getExternalStorageDirectory().getAbsolutePath() + "/tmprecording.mp3"; + } else { + this.tempFile = "/data/data/" + handler.ctx.getPackageName() + "/cache/tmprecording.mp3"; + } } /** @@ -151,11 +155,16 @@ public class AudioPlayer implements OnCompletionListener, OnPreparedListener, On * * @param file */ - public void moveFile(String file) { - + public void moveFile(String file) { /* this is a hack to save the file as the specified name */ File f = new File(this.tempFile); - f.renameTo(new File("/sdcard/" + file)); + if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) { + f.renameTo(new File(Environment.getExternalStorageDirectory().getAbsolutePath() + + File.separator + file)); + } else { + f.renameTo(new File("/data/data/" + handler.ctx.getPackageName() + "/cache/" + file)); + } + } /**