diff --git a/bin/create b/bin/create index e7670441..736fa142 100755 --- a/bin/create +++ b/bin/create @@ -38,10 +38,13 @@ fi # update the cordova-android framework for the desired target android update project --target $TARGET --path ./framework -# Use curl to get the jar (TODO: Support Apache Mirrors) -curl -OL http://mirror.symnds.com/software/Apache//commons/codec/binaries/commons-codec-1.6-bin.zip -unzip commons-codec-1.6-bin.zip -cp commons-codec-1.6/commons-codec-1.6.jar ./framework/libs +if [ ! -e ./framework/libs/commons-codec-1.6.jar ]; then + # Use curl to get the jar (TODO: Support Apache Mirrors) + curl -OL http://mirror.symnds.com/software/Apache//commons/codec/binaries/commons-codec-1.6-bin.zip + unzip commons-codec-1.6-bin.zip + mkdir -p ./framework/libs + cp commons-codec-1.6/commons-codec-1.6.jar ./framework/libs/ +fi # compile cordova.js and cordova.jar cd ./framework && ant jar && cd ../ diff --git a/framework/src/org/apache/cordova/AccelListener.java b/framework/src/org/apache/cordova/AccelListener.java index 9e19d753..83a322d6 100755 --- a/framework/src/org/apache/cordova/AccelListener.java +++ b/framework/src/org/apache/cordova/AccelListener.java @@ -223,7 +223,7 @@ public class AccelListener extends Plugin implements SensorEventListener { if (this.accuracy >= SensorManager.SENSOR_STATUS_ACCURACY_MEDIUM) { // Save time that event was received - this.timestamp = System.currentTimeMillis(); + this.timestamp = System.nanoTime(); this.x = event.values[0]; this.y = event.values[1]; this.z = event.values[2]; diff --git a/framework/src/org/apache/cordova/Capture.java b/framework/src/org/apache/cordova/Capture.java index ce7e9de0..9809ed11 100644 --- a/framework/src/org/apache/cordova/Capture.java +++ b/framework/src/org/apache/cordova/Capture.java @@ -353,7 +353,7 @@ public class Capture extends Plugin { try { // File properties obj.put("name", fp.getName()); - obj.put("fullPath", fp.getAbsolutePath()); + obj.put("fullPath", "file://" + fp.getAbsolutePath()); // Because of an issue with MimeTypeMap.getMimeTypeFromExtension() all .3gpp files // are reported as video/3gpp. I'm doing this hacky check of the URI to see if it 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 0) { - contact.put("websites", websites); + contact.put("urls", websites); } if (photos.length() > 0) { contact.put("photos", photos); } } catch (JSONException e) { - Log.e(LOG_TAG,e.getMessage(),e); + Log.e(LOG_TAG,e.getMessage(),e); } return contact; } @@ -579,10 +582,24 @@ public class ContactAccessorSdk5 extends ContactAccessor { whereArgs.add(searchTerm); whereArgs.add(ContactsContract.CommonDataKinds.Organization.CONTENT_ITEM_TYPE); } -// else if (key.startsWith("birthday")) { -// where.add("(" + dbMap.get(key) + " LIKE ? AND " -// + ContactsContract.Data.MIMETYPE + " = ? )"); -// } + else if (key.startsWith("birthday")) { + try { + SimpleDateFormat format = new SimpleDateFormat("EEEE, MMMM dd, yyyy"); + Date searchDate = format.parse(searchTerm.substring(1, searchTerm.length()-1)); + // Have to subtract one from the month as JavaScript's January is 01 + // while Java's January is 00. + searchDate.setMonth(searchDate.getMonth()-1); + SimpleDateFormat newFormat = new SimpleDateFormat("yyyy-MM-dd"); + + where.add("(" + dbMap.get(key) + " = ? AND " + + ContactsContract.Data.MIMETYPE + " = ? )"); + whereArgs.add(newFormat.format(searchDate)); + whereArgs.add(ContactsContract.CommonDataKinds.Event.CONTENT_ITEM_TYPE); + } + catch (ParseException e) { + Log.d(LOG_TAG, "Bad romance format"); + } + } else if (key.startsWith("note")) { where.add("(" + dbMap.get(key) + " LIKE ? AND " + ContactsContract.Data.MIMETYPE + " = ? )"); @@ -1149,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