incubator-callback-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fil...@apache.org
Subject android commit: Fixed the 0-byte files in gallery. Also fixed exif rewriter for saveToPhotoAlbum:false JPG files. Thanks for your help Simon!
Date Thu, 21 Jun 2012 19:06:59 GMT
Updated Branches:
  refs/heads/mediascanner 913459a64 -> b96adf43d


Fixed the 0-byte files in gallery. Also fixed exif rewriter for saveToPhotoAlbum:false JPG
files. Thanks for your help Simon!


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/b96adf43
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/tree/b96adf43
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/diff/b96adf43

Branch: refs/heads/mediascanner
Commit: b96adf43d94cd5d37821db9ec928c6833ebd71e3
Parents: 913459a
Author: Fil Maj <maj.fil@gmail.com>
Authored: Thu Jun 21 12:08:07 2012 -0700
Committer: Fil Maj <maj.fil@gmail.com>
Committed: Thu Jun 21 12:08:07 2012 -0700

----------------------------------------------------------------------
 .../src/org/apache/cordova/CameraLauncher.java     |   40 +++++++-------
 1 files changed, 20 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/b96adf43/framework/src/org/apache/cordova/CameraLauncher.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/CameraLauncher.java b/framework/src/org/apache/cordova/CameraLauncher.java
index a94e984..c87d81f 100755
--- a/framework/src/org/apache/cordova/CameraLauncher.java
+++ b/framework/src/org/apache/cordova/CameraLauncher.java
@@ -337,27 +337,9 @@ public class CameraLauncher extends Plugin implements MediaScannerConnectionClie
 
                     // If sending filename back
                     else if (destType == FILE_URI) {
-                        // Create entry in media store for image
-                        // (Don't use insertImage() because it uses default compression setting
of 50 - no way to change it)
-                        ContentValues values = new ContentValues();
-                        values.put(android.provider.MediaStore.Images.Media.MIME_TYPE, "image/jpeg");
-
-                       
-                        try {
-                            this.imageUri = this.cordova.getActivity().getContentResolver().insert(android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
values);
-                        } catch (UnsupportedOperationException e) {
-                            LOG.d(LOG_TAG, "Can't write to external media storage.");
-                            try {
-                                this.imageUri = this.cordova.getActivity().getContentResolver().insert(android.provider.MediaStore.Images.Media.INTERNAL_CONTENT_URI,
values);
-                            } catch (UnsupportedOperationException ex) {
-                                LOG.d(LOG_TAG, "Can't write to internal media storage.");
-                                this.failPicture("Error capturing image - no media storage
found.");
-                                return;
-                            }
-                        }
                         if (!this.saveToPhotoAlbum) {
                             File tempFile = new File(this.imageUri.toString());
-                            Uri jailURI = Uri.fromFile(new File("/data/data/" + this.cordova.getActivity().getPackageName()
+ "/", tempFile.getName() + "." + (this.encodingType == JPEG ? "jpg" : "png" )));
+                            Uri jailURI = Uri.fromFile(new File("/data/data/" + this.cordova.getActivity().getPackageName()
+ "/", tempFile.getName()));
                             
                             // Clean up initial URI before writing out safe URI.
                             // First try File-based approach to delete. Then use the media
delete method. Neither seem to work on ICS right now...
@@ -370,6 +352,24 @@ public class CameraLauncher extends Plugin implements MediaScannerConnectionClie
                                 );
                             }
                             this.imageUri = jailURI;
+                        } else {
+                            // Create entry in media store for image
+                            // (Don't use insertImage() because it uses default compression
setting of 50 - no way to change it)
+                            ContentValues values = new ContentValues();
+                            values.put(android.provider.MediaStore.Images.Media.MIME_TYPE,
"image/jpeg");
+
+                            try {
+                                this.imageUri = this.cordova.getActivity().getContentResolver().insert(android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
values);
+                            } catch (UnsupportedOperationException e) {
+                                LOG.d(LOG_TAG, "Can't write to external media storage.");
+                                try {
+                                    this.imageUri = this.cordova.getActivity().getContentResolver().insert(android.provider.MediaStore.Images.Media.INTERNAL_CONTENT_URI,
values);
+                                } catch (UnsupportedOperationException ex) {
+                                    LOG.d(LOG_TAG, "Can't write to internal media storage.");
+                                    this.failPicture("Error capturing image - no media storage
found.");
+                                    return;
+                                }
+                            }
                         }
 
                         // Add compressed version of captured image to returned media store
Uri
@@ -384,7 +384,7 @@ public class CameraLauncher extends Plugin implements MediaScannerConnectionClie
                             if (this.saveToPhotoAlbum) {
                                 exifPath = FileUtils.getRealPathFromURI(this.imageUri, this.cordova);
                             } else {
-                                exifPath = this.imageUri.toString();
+                                exifPath = this.imageUri.getPath();
                             }
                             exif.createOutFile(exifPath);
                             exif.writeExifData();


Mime
View raw message