diff --git a/src/android/CameraLauncher.java b/src/android/CameraLauncher.java index 5db8d89..971dd4a 100644 --- a/src/android/CameraLauncher.java +++ b/src/android/CameraLauncher.java @@ -52,8 +52,9 @@ public class CameraLauncher extends CordovaPlugin { } intent.putExtra("miniature", args.getBoolean(1)); - intent.putExtra("cameraBackgroundColor", args.getString(2)); - intent.putExtra("cameraBackgroundColorPressed", args.getString(3)); + intent.putExtra("saveInGallery", args.getBoolean(2)); + intent.putExtra("cameraBackgroundColor", args.getString(3)); + intent.putExtra("cameraBackgroundColorPressed", args.getString(4)); cordova.startActivityForResult((CordovaPlugin) this, intent, CameraLauncher.REQUEST_CODE); diff --git a/src/android/customCamera/src/org/geneanet/customcamera/CameraActivity.java b/src/android/customCamera/src/org/geneanet/customcamera/CameraActivity.java index c1fcee9..8fe1722 100644 --- a/src/android/customCamera/src/org/geneanet/customcamera/CameraActivity.java +++ b/src/android/customCamera/src/org/geneanet/customcamera/CameraActivity.java @@ -660,16 +660,18 @@ public class CameraActivity extends Activity { ByteArrayOutputStream stream = new ByteArrayOutputStream(); photoTaken.compress(CompressFormat.JPEG, 70, stream); - // Get path picture to storage. - String pathPicture = Environment.getExternalStorageDirectory() - .getPath() + "/" + Environment.DIRECTORY_DCIM + "/Camera/"; - pathPicture = pathPicture - + String.format("%d.jpeg", System.currentTimeMillis()); + if (this.getIntent().getBooleanExtra("saveInGallery", false)) { + // Get path picture to storage. + String pathPicture = Environment.getExternalStorageDirectory() + .getPath() + "/" + Environment.DIRECTORY_DCIM + "/Camera/"; + pathPicture = pathPicture + + String.format("%d.jpeg", System.currentTimeMillis()); - // Write data in file. - FileOutputStream outStream = new FileOutputStream(pathPicture); - outStream.write(stream.toByteArray()); - outStream.close(); + // Write data in file. + FileOutputStream outStream = new FileOutputStream(pathPicture); + outStream.write(stream.toByteArray()); + outStream.close(); + } TransferBigData.setImgTaken(stream.toByteArray()); diff --git a/www/customCamera.js b/www/customCamera.js index c16d846..7c9544d 100644 --- a/www/customCamera.js +++ b/www/customCamera.js @@ -18,6 +18,7 @@ var defaultOptions = { imgBackgroundBase64: null, // background picture in base64. miniature: true, // active or disable the miniature function. + saveInGallery: false, // save or not the picture in gallery. cameraBackgroundColor: "#e26760", // color of the camera button. cameraBackgroundColorPressed: "#dc453d" // color of the pressed camera button. // To get supported color formats, go to see method parseColor : http://developer.android.com/reference/android/graphics/Color.html#parseColor(java.lang.String) @@ -45,6 +46,7 @@ [ options.imgBackgroundBase64, options.miniature, + options.saveInGallery, options.cameraBackgroundColor, options.cameraBackgroundColorPressed ]