9
0
mirror of https://gitee.com/shuto/customCamera.git synced 2024-10-06 10:22:07 +08:00

Ajout de l'option pour stocker la photo dans la gallery android.

This commit is contained in:
Christophe BOUCAUT 2015-01-19 14:13:11 +01:00
parent 651cb8b7ef
commit b523e2dd05
3 changed files with 16 additions and 11 deletions

View File

@ -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);

View File

@ -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());

View File

@ -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
]