mirror of
https://github.com/apache/cordova-android.git
synced 2025-02-26 20:33:07 +08:00
Massive Merge Commit of DEATH TO SPACES
This commit is contained in:
commit
81195db87d
@ -18,12 +18,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.cordova;
|
package org.apache.cordova;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.apache.cordova.api.CordovaInterface;
|
import org.apache.cordova.api.CordovaInterface;
|
||||||
import org.apache.cordova.api.Plugin;
|
import org.apache.cordova.api.Plugin;
|
||||||
import org.apache.cordova.api.PluginResult;
|
import org.apache.cordova.api.PluginResult;
|
||||||
@ -35,8 +30,6 @@ import android.hardware.Sensor;
|
|||||||
import android.hardware.SensorEvent;
|
import android.hardware.SensorEvent;
|
||||||
import android.hardware.SensorEventListener;
|
import android.hardware.SensorEventListener;
|
||||||
import android.hardware.SensorManager;
|
import android.hardware.SensorManager;
|
||||||
import android.location.Location;
|
|
||||||
import android.util.Log;
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -258,7 +251,6 @@ public class AccelListener extends Plugin implements SensorEventListener {
|
|||||||
private void setStatus(int status) {
|
private void setStatus(int status) {
|
||||||
this.status = status;
|
this.status = status;
|
||||||
}
|
}
|
||||||
|
|
||||||
private JSONObject getAccelerationJSON() {
|
private JSONObject getAccelerationJSON() {
|
||||||
JSONObject r = new JSONObject();
|
JSONObject r = new JSONObject();
|
||||||
try {
|
try {
|
||||||
|
@ -102,7 +102,7 @@ public class App extends Plugin {
|
|||||||
* @throws JSONException
|
* @throws JSONException
|
||||||
*/
|
*/
|
||||||
public void loadUrl(String url, JSONObject props) throws JSONException {
|
public void loadUrl(String url, JSONObject props) throws JSONException {
|
||||||
LOG.d("App", "App.loadUrl(" + url + "," + props + ")");
|
LOG.d("App", "App.loadUrl("+url+","+props+")");
|
||||||
int wait = 0;
|
int wait = 0;
|
||||||
boolean openExternal = false;
|
boolean openExternal = false;
|
||||||
boolean clearHistory = false;
|
boolean clearHistory = false;
|
||||||
@ -128,13 +128,13 @@ public class App extends Plugin {
|
|||||||
|
|
||||||
}
|
}
|
||||||
else if (value.getClass().equals(String.class)) {
|
else if (value.getClass().equals(String.class)) {
|
||||||
params.put(key, (String) value);
|
params.put(key, (String)value);
|
||||||
}
|
}
|
||||||
else if (value.getClass().equals(Boolean.class)) {
|
else if (value.getClass().equals(Boolean.class)) {
|
||||||
params.put(key, (Boolean) value);
|
params.put(key, (Boolean)value);
|
||||||
}
|
}
|
||||||
else if (value.getClass().equals(Integer.class)) {
|
else if (value.getClass().equals(Integer.class)) {
|
||||||
params.put(key, (Integer) value);
|
params.put(key, (Integer)value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -144,7 +144,7 @@ public class App extends Plugin {
|
|||||||
|
|
||||||
if (wait > 0) {
|
if (wait > 0) {
|
||||||
try {
|
try {
|
||||||
synchronized (this) {
|
synchronized(this) {
|
||||||
this.wait(wait);
|
this.wait(wait);
|
||||||
}
|
}
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
|
@ -22,7 +22,6 @@ import android.content.Context;
|
|||||||
import android.media.AudioManager;
|
import android.media.AudioManager;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
//import org.apache.cordova.api.LOG;
|
|
||||||
import org.apache.cordova.api.Plugin;
|
import org.apache.cordova.api.Plugin;
|
||||||
import org.apache.cordova.api.PluginResult;
|
import org.apache.cordova.api.PluginResult;
|
||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
@ -56,7 +55,6 @@ public class AudioHandler extends Plugin {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Executes the request and returns PluginResult.
|
* Executes the request and returns PluginResult.
|
||||||
*
|
|
||||||
* @param action The action to execute.
|
* @param action The action to execute.
|
||||||
* @param args JSONArry of arguments for the plugin.
|
* @param args JSONArry of arguments for the plugin.
|
||||||
* @param callbackId The callback id used when calling back into JavaScript.
|
* @param callbackId The callback id used when calling back into JavaScript.
|
||||||
@ -111,7 +109,6 @@ public class AudioHandler extends Plugin {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Identifies if action to be executed returns a value and should be run synchronously.
|
* Identifies if action to be executed returns a value and should be run synchronously.
|
||||||
*
|
|
||||||
* @param action The action to execute
|
* @param action The action to execute
|
||||||
* @return T=returns value
|
* @return T=returns value
|
||||||
*/
|
*/
|
||||||
@ -177,7 +174,6 @@ public class AudioHandler extends Plugin {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Release the audio player instance to save memory.
|
* Release the audio player instance to save memory.
|
||||||
*
|
|
||||||
* @param id The id of the audio player
|
* @param id The id of the audio player
|
||||||
*/
|
*/
|
||||||
private boolean release(String id) {
|
private boolean release(String id) {
|
||||||
@ -192,7 +188,6 @@ public class AudioHandler extends Plugin {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Start recording and save the specified file.
|
* Start recording and save the specified file.
|
||||||
*
|
|
||||||
* @param id The id of the audio player
|
* @param id The id of the audio player
|
||||||
* @param file The name of the file
|
* @param file The name of the file
|
||||||
*/
|
*/
|
||||||
@ -208,7 +203,6 @@ public class AudioHandler extends Plugin {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Stop recording and save to the file specified when recording started.
|
* Stop recording and save to the file specified when recording started.
|
||||||
*
|
|
||||||
* @param id The id of the audio player
|
* @param id The id of the audio player
|
||||||
*/
|
*/
|
||||||
public void stopRecordingAudio(String id) {
|
public void stopRecordingAudio(String id) {
|
||||||
@ -221,7 +215,6 @@ public class AudioHandler extends Plugin {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Start or resume playing audio file.
|
* Start or resume playing audio file.
|
||||||
*
|
|
||||||
* @param id The id of the audio player
|
* @param id The id of the audio player
|
||||||
* @param file The name of the audio file.
|
* @param file The name of the audio file.
|
||||||
*/
|
*/
|
||||||
@ -236,8 +229,6 @@ public class AudioHandler extends Plugin {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Seek to a location.
|
* Seek to a location.
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param id The id of the audio player
|
* @param id The id of the audio player
|
||||||
* @param miliseconds int: number of milliseconds to skip 1000 = 1 second
|
* @param miliseconds int: number of milliseconds to skip 1000 = 1 second
|
||||||
*/
|
*/
|
||||||
@ -250,7 +241,6 @@ public class AudioHandler extends Plugin {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Pause playing.
|
* Pause playing.
|
||||||
*
|
|
||||||
* @param id The id of the audio player
|
* @param id The id of the audio player
|
||||||
*/
|
*/
|
||||||
public void pausePlayingAudio(String id) {
|
public void pausePlayingAudio(String id) {
|
||||||
@ -262,7 +252,6 @@ public class AudioHandler extends Plugin {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Stop playing the audio file.
|
* Stop playing the audio file.
|
||||||
*
|
|
||||||
* @param id The id of the audio player
|
* @param id The id of the audio player
|
||||||
*/
|
*/
|
||||||
public void stopPlayingAudio(String id) {
|
public void stopPlayingAudio(String id) {
|
||||||
@ -276,7 +265,6 @@ public class AudioHandler extends Plugin {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get current position of playback.
|
* Get current position of playback.
|
||||||
*
|
|
||||||
* @param id The id of the audio player
|
* @param id The id of the audio player
|
||||||
* @return position in msec
|
* @return position in msec
|
||||||
*/
|
*/
|
||||||
@ -290,7 +278,6 @@ public class AudioHandler extends Plugin {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the duration of the audio file.
|
* Get the duration of the audio file.
|
||||||
*
|
|
||||||
* @param id The id of the audio player
|
* @param id The id of the audio player
|
||||||
* @param file The name of the audio file.
|
* @param file The name of the audio file.
|
||||||
* @return The duration in msec.
|
* @return The duration in msec.
|
||||||
|
@ -88,7 +88,7 @@ public class AudioPlayer implements OnCompletionListener, OnPreparedListener, On
|
|||||||
if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
|
if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
|
||||||
this.tempFile = Environment.getExternalStorageDirectory().getAbsolutePath() + "/tmprecording.mp3";
|
this.tempFile = Environment.getExternalStorageDirectory().getAbsolutePath() + "/tmprecording.mp3";
|
||||||
} else {
|
} else {
|
||||||
this.tempFile = "/data/data/" + handler.ctx.getPackageName() + "/cache/tmprecording.mp3";
|
this.tempFile = "/data/data/" + handler.ctx.getActivity().getPackageName() + "/cache/tmprecording.mp3";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -96,7 +96,6 @@ public class AudioPlayer implements OnCompletionListener, OnPreparedListener, On
|
|||||||
* Destroy player and stop audio playing or recording.
|
* Destroy player and stop audio playing or recording.
|
||||||
*/
|
*/
|
||||||
public void destroy() {
|
public void destroy() {
|
||||||
|
|
||||||
// Stop any play or record
|
// Stop any play or record
|
||||||
if (this.mPlayer != null) {
|
if (this.mPlayer != null) {
|
||||||
if ((this.state == MEDIA_RUNNING) || (this.state == MEDIA_PAUSED)) {
|
if ((this.state == MEDIA_RUNNING) || (this.state == MEDIA_PAUSED)) {
|
||||||
@ -123,7 +122,6 @@ public class AudioPlayer implements OnCompletionListener, OnPreparedListener, On
|
|||||||
Log.d(LOG_TAG, "AudioPlayer Error: Can't record in play mode.");
|
Log.d(LOG_TAG, "AudioPlayer Error: Can't record in play mode.");
|
||||||
this.handler.sendJavascript("cordova.require('cordova/plugin/Media').onStatus('" + this.id + "', "+MEDIA_ERROR+", { \"code\":"+MEDIA_ERR_ABORTED+"});");
|
this.handler.sendJavascript("cordova.require('cordova/plugin/Media').onStatus('" + this.id + "', "+MEDIA_ERROR+", { \"code\":"+MEDIA_ERR_ABORTED+"});");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make sure we're not already recording
|
// Make sure we're not already recording
|
||||||
else if (this.recorder == null) {
|
else if (this.recorder == null) {
|
||||||
this.audioFile = file;
|
this.audioFile = file;
|
||||||
@ -162,7 +160,7 @@ public class AudioPlayer implements OnCompletionListener, OnPreparedListener, On
|
|||||||
f.renameTo(new File(Environment.getExternalStorageDirectory().getAbsolutePath()
|
f.renameTo(new File(Environment.getExternalStorageDirectory().getAbsolutePath()
|
||||||
+ File.separator + file));
|
+ File.separator + file));
|
||||||
} else {
|
} else {
|
||||||
f.renameTo(new File("/data/data/" + handler.ctx.getPackageName() + "/cache/" + file));
|
f.renameTo(new File("/data/data/" + handler.ctx.getActivity().getPackageName() + "/cache/" + file));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -172,13 +170,14 @@ public class AudioPlayer implements OnCompletionListener, OnPreparedListener, On
|
|||||||
*/
|
*/
|
||||||
public void stopRecording() {
|
public void stopRecording() {
|
||||||
if (this.recorder != null) {
|
if (this.recorder != null) {
|
||||||
try {
|
try{
|
||||||
if (this.state == MEDIA_RUNNING) {
|
if (this.state == MEDIA_RUNNING) {
|
||||||
this.recorder.stop();
|
this.recorder.stop();
|
||||||
this.setState(MEDIA_STOPPED);
|
this.setState(MEDIA_STOPPED);
|
||||||
}
|
}
|
||||||
this.moveFile(this.audioFile);
|
this.moveFile(this.audioFile);
|
||||||
} catch (Exception e) {
|
}
|
||||||
|
catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -110,9 +110,8 @@ public class CallbackServer implements Runnable {
|
|||||||
*
|
*
|
||||||
* @param url The URL of the Cordova app being loaded
|
* @param url The URL of the Cordova app being loaded
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
public void init(String url) {
|
public void init(String url) {
|
||||||
//Log.d(LOG_TAG, "CallbackServer.start("+url+")");
|
//System.out.println("CallbackServer.start("+url+")");
|
||||||
this.active = false;
|
this.active = false;
|
||||||
this.empty = true;
|
this.empty = true;
|
||||||
this.port = 0;
|
this.port = 0;
|
||||||
@ -145,7 +144,6 @@ public class CallbackServer implements Runnable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Return if polling is being used instead of XHR.
|
* Return if polling is being used instead of XHR.
|
||||||
*
|
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public boolean usePolling() {
|
public boolean usePolling() {
|
||||||
@ -154,7 +152,6 @@ public class CallbackServer implements Runnable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the port that this server is running on.
|
* Get the port that this server is running on.
|
||||||
*
|
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public int getPort() {
|
public int getPort() {
|
||||||
@ -163,7 +160,6 @@ public class CallbackServer implements Runnable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the security token that this server requires when calling getJavascript().
|
* Get the security token that this server requires when calling getJavascript().
|
||||||
*
|
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public String getToken() {
|
public String getToken() {
|
||||||
|
@ -305,7 +305,6 @@ public class CameraLauncher extends Plugin {
|
|||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
// If CAMERA
|
// If CAMERA
|
||||||
if (srcType == CAMERA) {
|
if (srcType == CAMERA) {
|
||||||
// If image available
|
// If image available
|
||||||
|
@ -54,7 +54,7 @@ public class Capture extends Plugin {
|
|||||||
// private static final int CAPTURE_APPLICATION_BUSY = 1;
|
// private static final int CAPTURE_APPLICATION_BUSY = 1;
|
||||||
// private static final int CAPTURE_INVALID_ARGUMENT = 2;
|
// private static final int CAPTURE_INVALID_ARGUMENT = 2;
|
||||||
private static final int CAPTURE_NO_MEDIA_FILES = 3;
|
private static final int CAPTURE_NO_MEDIA_FILES = 3;
|
||||||
// private static final int CAPTURE_NOT_SUPPORTED = 20;
|
private static final int CAPTURE_NOT_SUPPORTED = 20;
|
||||||
|
|
||||||
private String callbackId; // The ID of the callback to be invoked with our result
|
private String callbackId; // The ID of the callback to be invoked with our result
|
||||||
private long limit; // the number of pics/vids/clips to take
|
private long limit; // the number of pics/vids/clips to take
|
||||||
|
@ -25,10 +25,7 @@ import java.io.FileNotFoundException;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.text.ParseException;
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
@ -115,7 +112,7 @@ public class ContactAccessorSdk5 extends ContactAccessor {
|
|||||||
dbMap.put("organizations.name", ContactsContract.CommonDataKinds.Organization.COMPANY);
|
dbMap.put("organizations.name", ContactsContract.CommonDataKinds.Organization.COMPANY);
|
||||||
dbMap.put("organizations.department", ContactsContract.CommonDataKinds.Organization.DEPARTMENT);
|
dbMap.put("organizations.department", ContactsContract.CommonDataKinds.Organization.DEPARTMENT);
|
||||||
dbMap.put("organizations.title", ContactsContract.CommonDataKinds.Organization.TITLE);
|
dbMap.put("organizations.title", ContactsContract.CommonDataKinds.Organization.TITLE);
|
||||||
dbMap.put("birthday", ContactsContract.CommonDataKinds.Event.START_DATE);
|
dbMap.put("birthday", ContactsContract.CommonDataKinds.Event.CONTENT_ITEM_TYPE);
|
||||||
dbMap.put("note", ContactsContract.CommonDataKinds.Note.NOTE);
|
dbMap.put("note", ContactsContract.CommonDataKinds.Note.NOTE);
|
||||||
dbMap.put("photos.value", ContactsContract.CommonDataKinds.Photo.CONTENT_ITEM_TYPE);
|
dbMap.put("photos.value", ContactsContract.CommonDataKinds.Photo.CONTENT_ITEM_TYPE);
|
||||||
//dbMap.put("categories.value", null);
|
//dbMap.put("categories.value", null);
|
||||||
@ -581,30 +578,26 @@ public class ContactAccessorSdk5 extends ContactAccessor {
|
|||||||
whereArgs.add(searchTerm);
|
whereArgs.add(searchTerm);
|
||||||
whereArgs.add(ContactsContract.CommonDataKinds.Organization.CONTENT_ITEM_TYPE);
|
whereArgs.add(ContactsContract.CommonDataKinds.Organization.CONTENT_ITEM_TYPE);
|
||||||
}
|
}
|
||||||
else if (key.startsWith("birthday")) {
|
// else if (key.startsWith("birthday")) {
|
||||||
try {
|
// where.add("(" + dbMap.get(key) + " LIKE ? AND "
|
||||||
SimpleDateFormat format = new SimpleDateFormat("EEEE, MMMM dd, yyyy");
|
// + ContactsContract.Data.MIMETYPE + " = ? )");
|
||||||
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")) {
|
else if (key.startsWith("note")) {
|
||||||
where.add("(" + dbMap.get(key) + " LIKE ? AND "
|
where.add("(" + dbMap.get(key) + " LIKE ? AND "
|
||||||
+ ContactsContract.Data.MIMETYPE + " = ? )");
|
+ ContactsContract.Data.MIMETYPE + " = ? )");
|
||||||
whereArgs.add(searchTerm);
|
whereArgs.add(searchTerm);
|
||||||
whereArgs.add(ContactsContract.CommonDataKinds.Note.CONTENT_ITEM_TYPE);
|
whereArgs.add(ContactsContract.CommonDataKinds.Note.CONTENT_ITEM_TYPE);
|
||||||
}
|
}
|
||||||
|
else if (key.startsWith("urls")) {
|
||||||
|
where.add("(" + dbMap.get(key) + " LIKE ? AND "
|
||||||
|
+ ContactsContract.Data.MIMETYPE + " = ? )");
|
||||||
|
whereArgs.add(searchTerm);
|
||||||
|
whereArgs.add(ContactsContract.CommonDataKinds.Website.CONTENT_ITEM_TYPE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (JSONException e) {
|
||||||
|
Log.e(LOG_TAG, e.getMessage(), e);
|
||||||
|
}
|
||||||
|
|
||||||
// Creating the where string
|
// Creating the where string
|
||||||
StringBuffer selection = new StringBuffer();
|
StringBuffer selection = new StringBuffer();
|
||||||
@ -1140,42 +1133,13 @@ public class ContactAccessorSdk5 extends ContactAccessor {
|
|||||||
ops.add(ContentProviderOperation.newUpdate(ContactsContract.Data.CONTENT_URI)
|
ops.add(ContentProviderOperation.newUpdate(ContactsContract.Data.CONTENT_URI)
|
||||||
.withSelection(ContactsContract.Data.CONTACT_ID + "=? AND " +
|
.withSelection(ContactsContract.Data.CONTACT_ID + "=? AND " +
|
||||||
ContactsContract.Data.MIMETYPE + "=?",
|
ContactsContract.Data.MIMETYPE + "=?",
|
||||||
new String[]{id,ContactsContract.CommonDataKinds.Note.CONTENT_ITEM_TYPE})
|
new String[] { id, ContactsContract.CommonDataKinds.Note.CONTENT_ITEM_TYPE })
|
||||||
.withValue(ContactsContract.CommonDataKinds.Note.NOTE, note)
|
.withValue(ContactsContract.CommonDataKinds.Note.NOTE, note)
|
||||||
.build());
|
.build());
|
||||||
|
|
||||||
// Modify nickname
|
// Modify nickname
|
||||||
String nickname = getJsonString(contact, "nickname");
|
String nickname = getJsonString(contact, "nickname");
|
||||||
if (nickname != null) {
|
if (nickname != null) {
|
||||||
ops.add(ContentProviderOperation.newUpdate(ContactsContract.Data.CONTENT_URI)
|
|
||||||
.withSelection(ContactsContract.Data.CONTACT_ID + "=? AND " +
|
|
||||||
ContactsContract.Data.MIMETYPE + "=?",
|
|
||||||
new String[]{id,ContactsContract.CommonDataKinds.Nickname.CONTENT_ITEM_TYPE})
|
|
||||||
.withValue(ContactsContract.CommonDataKinds.Nickname.NAME, nickname)
|
|
||||||
.build());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Modify urls
|
|
||||||
JSONArray websites = null;
|
|
||||||
try {
|
|
||||||
websites = contact.getJSONArray("urls");
|
|
||||||
if (websites != null) {
|
|
||||||
for (int i=0; i<websites.length(); i++) {
|
|
||||||
JSONObject website = (JSONObject)websites.get(i);
|
|
||||||
String websiteId = getJsonString(website, "id");
|
|
||||||
// This is a new website so do a DB insert
|
|
||||||
if (websiteId==null) {
|
|
||||||
ContentValues contentValues = new ContentValues();
|
|
||||||
contentValues.put(ContactsContract.Data.RAW_CONTACT_ID, rawId);
|
|
||||||
contentValues.put(ContactsContract.Data.MIMETYPE, ContactsContract.CommonDataKinds.Website.CONTENT_ITEM_TYPE);
|
|
||||||
contentValues.put(ContactsContract.CommonDataKinds.Website.DATA, getJsonString(website, "value"));
|
|
||||||
contentValues.put(ContactsContract.CommonDataKinds.Website.TYPE, getContactType(getJsonString(website, "type")));
|
|
||||||
|
|
||||||
ops.add(ContentProviderOperation.newInsert(
|
|
||||||
ContactsContract.Data.CONTENT_URI).withValues(contentValues).build());
|
|
||||||
}
|
|
||||||
// This is an existing website so do a DB update
|
|
||||||
else {
|
|
||||||
ops.add(ContentProviderOperation.newUpdate(ContactsContract.Data.CONTENT_URI)
|
ops.add(ContentProviderOperation.newUpdate(ContactsContract.Data.CONTENT_URI)
|
||||||
.withSelection(ContactsContract.Data.CONTACT_ID + "=? AND " +
|
.withSelection(ContactsContract.Data.CONTACT_ID + "=? AND " +
|
||||||
ContactsContract.Data.MIMETYPE + "=?",
|
ContactsContract.Data.MIMETYPE + "=?",
|
||||||
@ -1963,3 +1927,4 @@ public class ContactAccessorSdk5 extends ContactAccessor {
|
|||||||
return stringType;
|
return stringType;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,7 +37,6 @@ public class DirectoryManager {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine if a file or directory exists.
|
* Determine if a file or directory exists.
|
||||||
*
|
|
||||||
* @param name The name of the file to check.
|
* @param name The name of the file to check.
|
||||||
* @return T=exists, F=not found
|
* @return T=exists, F=not found
|
||||||
*/
|
*/
|
||||||
@ -122,7 +121,7 @@ public class DirectoryManager {
|
|||||||
* @param file2 Remaining file path
|
* @param file2 Remaining file path
|
||||||
* @return File object
|
* @return File object
|
||||||
*/
|
*/
|
||||||
private static File constructFilePaths(String file1, String file2) {
|
private static File constructFilePaths (String file1, String file2) {
|
||||||
File newPath;
|
File newPath;
|
||||||
if (file2.startsWith(file1)) {
|
if (file2.startsWith(file1)) {
|
||||||
newPath = new File(file2);
|
newPath = new File(file2);
|
||||||
|
@ -173,6 +173,9 @@ public class DroidGap extends Activity implements CordovaInterface {
|
|||||||
protected int splashscreen = 0;
|
protected int splashscreen = 0;
|
||||||
protected int splashscreenTime = 0;
|
protected int splashscreenTime = 0;
|
||||||
|
|
||||||
|
// LoadUrl timeout value in msec (default of 20 sec)
|
||||||
|
protected int loadUrlTimeoutValue = 20000;
|
||||||
|
|
||||||
// Keep app running when pause is received. (default = true)
|
// Keep app running when pause is received. (default = true)
|
||||||
// If true, then the JavaScript and native code continue to run in the background
|
// If true, then the JavaScript and native code continue to run in the background
|
||||||
// when another application (activity) is started.
|
// when another application (activity) is started.
|
||||||
@ -723,7 +726,6 @@ public class DroidGap extends Activity implements CordovaInterface {
|
|||||||
* @param message
|
* @param message
|
||||||
*/
|
*/
|
||||||
public void sendJavascript(String statement) {
|
public void sendJavascript(String statement) {
|
||||||
//We need to check for the null case on the Kindle Fire because it changes the width and height on load
|
|
||||||
if (this.appView != null && this.appView.callbackServer != null) {
|
if (this.appView != null && this.appView.callbackServer != null) {
|
||||||
this.appView.callbackServer.sendJavascript(statement);
|
this.appView.callbackServer.sendJavascript(statement);
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,6 @@ import android.database.Cursor;
|
|||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Environment;
|
import android.os.Environment;
|
||||||
import android.provider.MediaStore;
|
import android.provider.MediaStore;
|
||||||
//import android.util.Log;
|
|
||||||
import android.webkit.MimeTypeMap;
|
import android.webkit.MimeTypeMap;
|
||||||
|
|
||||||
//import android.app.Activity;
|
//import android.app.Activity;
|
||||||
|
@ -58,10 +58,7 @@ public class HttpHandler {
|
|||||||
HttpGet httpget = new HttpGet(url);
|
HttpGet httpget = new HttpGet(url);
|
||||||
HttpResponse response = httpclient.execute(httpget);
|
HttpResponse response = httpclient.execute(httpget);
|
||||||
entity = response.getEntity();
|
entity = response.getEntity();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) { e.printStackTrace(); return null; }
|
||||||
e.printStackTrace();
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return entity;
|
return entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,9 +18,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.cordova;
|
package org.apache.cordova;
|
||||||
|
|
||||||
//import java.lang.reflect.Field;
|
|
||||||
|
|
||||||
//import android.app.Activity;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
public class StandAlone extends DroidGap {
|
public class StandAlone extends DroidGap {
|
||||||
|
@ -141,7 +141,7 @@ public class Storage extends Plugin {
|
|||||||
|
|
||||||
// If no database path, generate from application package
|
// If no database path, generate from application package
|
||||||
if (this.path == null) {
|
if (this.path == null) {
|
||||||
this.path = this.ctx.getActivity().getDir("database", Context.MODE_PRIVATE).getPath();
|
this.path = this.ctx.getActivity().getApplicationContext().getDir("database", Context.MODE_PRIVATE).getPath();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.dbName = this.path + File.pathSeparator + db + ".db";
|
this.dbName = this.path + File.pathSeparator + db + ".db";
|
||||||
|
@ -21,13 +21,12 @@ package org.apache.cordova.api;
|
|||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
|
||||||
//import android.util.Log;
|
|
||||||
|
|
||||||
public class PluginResult {
|
public class PluginResult {
|
||||||
private final int status;
|
private final int status;
|
||||||
private final String message;
|
private final String message;
|
||||||
private boolean keepCallback = false;
|
private boolean keepCallback = false;
|
||||||
|
|
||||||
|
|
||||||
public PluginResult(Status status) {
|
public PluginResult(Status status) {
|
||||||
this.status = status.ordinal();
|
this.status = status.ordinal();
|
||||||
this.message = "'" + PluginResult.StatusMessages[this.status] + "'";
|
this.message = "'" + PluginResult.StatusMessages[this.status] + "'";
|
||||||
|
Loading…
Reference in New Issue
Block a user