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

Ajout de la possibilité de régler la qualité de la photo.

This commit is contained in:
Christophe BOUCAUT 2015-01-19 17:21:39 +01:00
parent a991e3fb4c
commit 1635210b3c
3 changed files with 8 additions and 3 deletions

View File

@ -55,6 +55,9 @@ public class CameraLauncher extends CordovaPlugin {
intent.putExtra("saveInGallery", args.getBoolean(2)); intent.putExtra("saveInGallery", args.getBoolean(2));
intent.putExtra("cameraBackgroundColor", args.getString(3)); intent.putExtra("cameraBackgroundColor", args.getString(3));
intent.putExtra("cameraBackgroundColorPressed", args.getString(4)); intent.putExtra("cameraBackgroundColorPressed", args.getString(4));
if (args.getInt(5) >= 0 && args.getInt(5) <= 100) {
intent.putExtra("quality", args.getInt(5));
}
cordova.startActivityForResult((CordovaPlugin) this, intent, CameraLauncher.REQUEST_CODE); cordova.startActivityForResult((CordovaPlugin) this, intent, CameraLauncher.REQUEST_CODE);

View File

@ -658,7 +658,7 @@ public class CameraActivity extends Activity {
try { try {
ByteArrayOutputStream stream = new ByteArrayOutputStream(); ByteArrayOutputStream stream = new ByteArrayOutputStream();
photoTaken.compress(CompressFormat.JPEG, 70, stream); photoTaken.compress(CompressFormat.JPEG, this.getIntent().getIntExtra("quality", 100), stream);
if (this.getIntent().getBooleanExtra("saveInGallery", false)) { if (this.getIntent().getBooleanExtra("saveInGallery", false)) {
// Get path picture to storage. // Get path picture to storage.

View File

@ -20,8 +20,9 @@
miniature: true, // active or disable the miniature function. miniature: true, // active or disable the miniature function.
saveInGallery: false, // save or not the picture in gallery. saveInGallery: false, // save or not the picture in gallery.
cameraBackgroundColor: "#e26760", // color of the camera button. cameraBackgroundColor: "#e26760", // color of the camera button.
cameraBackgroundColorPressed: "#dc453d" // color of the pressed 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) // To get supported color formats, go to see method parseColor : http://developer.android.com/reference/android/graphics/Color.html#parseColor(java.lang.String)
quality: 100 // picture's quality : range 0 - 100 : http://developer.android.com/reference/android/graphics/Bitmap.html#compress(android.graphics.Bitmap.CompressFormat, int, java.io.OutputStream) (parameter "quality")
}; };
for (var nameOption in defaultOptions) { for (var nameOption in defaultOptions) {
@ -48,7 +49,8 @@
options.miniature, options.miniature,
options.saveInGallery, options.saveInGallery,
options.cameraBackgroundColor, options.cameraBackgroundColor,
options.cameraBackgroundColorPressed options.cameraBackgroundColorPressed,
options.quality
] ]
); );
}; };