incubator-callback-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From macdo...@apache.org
Subject android commit: CB-860: MediaFile.getFormatData broken for Image from Capture
Date Tue, 05 Jun 2012 12:46:09 GMT
Updated Branches:
  refs/heads/master 24e5c24dd -> adfdb16dc


CB-860: MediaFile.getFormatData broken for Image from Capture


Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/commit/adfdb16d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/tree/adfdb16d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/diff/adfdb16d

Branch: refs/heads/master
Commit: adfdb16dc5a726ac83d30b6b9daf61ab7c1129df
Parents: 24e5c24
Author: macdonst <simon.macdonald@gmail.com>
Authored: Tue Jun 5 08:42:17 2012 -0400
Committer: macdonst <simon.macdonald@gmail.com>
Committed: Tue Jun 5 08:45:33 2012 -0400

----------------------------------------------------------------------
 framework/src/org/apache/cordova/Capture.java   |    3 ++-
 framework/src/org/apache/cordova/FileUtils.java |    2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/adfdb16d/framework/src/org/apache/cordova/Capture.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/Capture.java b/framework/src/org/apache/cordova/Capture.java
index 9809ed1..1eb0b90 100644
--- a/framework/src/org/apache/cordova/Capture.java
+++ b/framework/src/org/apache/cordova/Capture.java
@@ -148,9 +148,10 @@ public class Capture extends Plugin {
      * @throws JSONException
      */
     private JSONObject getImageData(String filePath, JSONObject obj) throws JSONException
{
-        Bitmap bitmap = BitmapFactory.decodeFile(filePath);
+        Bitmap bitmap = BitmapFactory.decodeFile(FileUtils.stripFileProtocol(filePath));
         obj.put("height", bitmap.getHeight());
         obj.put("width", bitmap.getWidth());
+        bitmap.recycle();
         return obj;
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/adfdb16d/framework/src/org/apache/cordova/FileUtils.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/FileUtils.java b/framework/src/org/apache/cordova/FileUtils.java
index c7d0280..32d3678 100755
--- a/framework/src/org/apache/cordova/FileUtils.java
+++ b/framework/src/org/apache/cordova/FileUtils.java
@@ -740,7 +740,7 @@ public class FileUtils extends Plugin {
      * @param filePath to be checked.
      * @return
      */
-    private String stripFileProtocol(String filePath) {
+    public static String stripFileProtocol(String filePath) {
         if (filePath.startsWith("file://")) {
             filePath = filePath.substring(7);
         }


Mime
View raw message