Compare commits

...

3 Commits

Author SHA1 Message Date
macdonst 1511183dfd Tagging 1.3.0 2011-12-16 13:29:15 -05:00
macdonst a640804897 Tagging to 1.3.0rc2 2011-12-13 09:41:54 -05:00
macdonst f95fdb5873 Fix for CB-104: Capture not returning an error code on cancel 2011-12-06 06:08:35 +08:00
5 changed files with 27 additions and 9 deletions
+1 -1
View File
@@ -1 +1 @@
1.3.0rc1 1.3.0
@@ -5,7 +5,7 @@
<meta http-equiv="Content-type" content="text/html; charset=utf-8"> <meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>PhoneGap</title> <title>PhoneGap</title>
<link rel="stylesheet" href="master.css" type="text/css" media="screen" title="no title" charset="utf-8"> <link rel="stylesheet" href="master.css" type="text/css" media="screen" title="no title" charset="utf-8">
<script type="text/javascript" charset="utf-8" src="phonegap-1.3.0rc1.js"></script> <script type="text/javascript" charset="utf-8" src="phonegap-1.3.0.js"></script>
<script type="text/javascript" charset="utf-8" src="main.js"></script> <script type="text/javascript" charset="utf-8" src="main.js"></script>
</head> </head>
+1 -1
View File
@@ -1,7 +1,7 @@
<html> <html>
<head> <head>
<title></title> <title></title>
<script src="phonegap-1.3.0rc1.js"></script> <script src="phonegap-1.3.0.js"></script>
</head> </head>
<body> <body>
+23 -5
View File
@@ -49,6 +49,13 @@ public class Capture extends Plugin {
private static final int CAPTURE_IMAGE = 1; // Constant for capture image private static final int CAPTURE_IMAGE = 1; // Constant for capture image
private static final int CAPTURE_VIDEO = 2; // Constant for capture video private static final int CAPTURE_VIDEO = 2; // Constant for capture video
private static final String LOG_TAG = "Capture"; private static final String LOG_TAG = "Capture";
private static final int CAPTURE_INTERNAL_ERR = 0;
private static final int CAPTURE_APPLICATION_BUSY = 1;
private static final int CAPTURE_INVALID_ARGUMENT = 2;
private static final int CAPTURE_NO_MEDIA_FILES = 3;
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
private double duration; // optional duration parameter for video recording private double duration; // optional duration parameter for video recording
@@ -260,7 +267,7 @@ public class Capture extends Plugin {
uri = this.ctx.getContentResolver().insert(android.provider.MediaStore.Images.Media.INTERNAL_CONTENT_URI, values); uri = this.ctx.getContentResolver().insert(android.provider.MediaStore.Images.Media.INTERNAL_CONTENT_URI, values);
} catch (UnsupportedOperationException ex) { } catch (UnsupportedOperationException ex) {
LOG.d(LOG_TAG, "Can't write to internal media storage."); LOG.d(LOG_TAG, "Can't write to internal media storage.");
this.fail("Error capturing image - no media storage found."); this.fail(createErrorObject(CAPTURE_INTERNAL_ERR, "Error capturing image - no media storage found."));
return; return;
} }
} }
@@ -290,7 +297,7 @@ public class Capture extends Plugin {
} }
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
this.fail("Error capturing image."); this.fail(createErrorObject(CAPTURE_INTERNAL_ERR, "Error capturing image."));
} }
} else if (requestCode == CAPTURE_VIDEO) { } else if (requestCode == CAPTURE_VIDEO) {
// Get the uri of the video clip // Get the uri of the video clip
@@ -315,7 +322,7 @@ public class Capture extends Plugin {
} }
// user canceled the action // user canceled the action
else { else {
this.fail("Canceled."); this.fail(createErrorObject(CAPTURE_NO_MEDIA_FILES, "Canceled."));
} }
} }
// If something else // If something else
@@ -326,7 +333,7 @@ public class Capture extends Plugin {
} }
// something bad happened // something bad happened
else { else {
this.fail("Did not complete!"); this.fail(createErrorObject(CAPTURE_NO_MEDIA_FILES, "Did not complete!"));
} }
} }
} }
@@ -370,12 +377,23 @@ public class Capture extends Plugin {
return obj; return obj;
} }
private JSONObject createErrorObject(int code, String message) {
JSONObject obj = new JSONObject();
try {
obj.put("code", code);
obj.put("message", message);
} catch (JSONException e) {
// This will never happen
}
return obj;
}
/** /**
* Send error message to JavaScript. * Send error message to JavaScript.
* *
* @param err * @param err
*/ */
public void fail(String err) { public void fail(JSONObject err) {
this.error(new PluginResult(PluginResult.Status.ERROR, err), this.callbackId); this.error(new PluginResult(PluginResult.Status.ERROR, err), this.callbackId);
} }
} }
+1 -1
View File
@@ -37,7 +37,7 @@ import android.telephony.TelephonyManager;
public class Device extends Plugin { public class Device extends Plugin {
public static final String TAG = "Device"; public static final String TAG = "Device";
public static String phonegapVersion = "1.3.0rc1"; // PhoneGap version public static String phonegapVersion = "1.3.0"; // PhoneGap version
public static String platform = "Android"; // Device OS public static String platform = "Android"; // Device OS
public static String uuid; // Device UUID public static String uuid; // Device UUID