9
0
mirror of https://gitee.com/shuto/customCamera.git synced 2026-05-02 00:07:24 +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
+3 -2
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);
@@ -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());