Reverted indenting done by Android Studio
This commit is contained in:
parent
832d6e3bea
commit
e3a431cbeb
@ -392,52 +392,53 @@ public class CameraLauncher extends CordovaPlugin implements MediaScannerConnect
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Brings up the UI to perform crop on passed image URI
|
|
||||||
*
|
|
||||||
* @param picUri
|
|
||||||
*/
|
|
||||||
private void performCrop(Uri picUri, int destType, Intent cameraIntent) {
|
|
||||||
try {
|
|
||||||
Intent cropIntent = new Intent("com.android.camera.action.CROP");
|
|
||||||
// indicate image type and Uri
|
|
||||||
cropIntent.setDataAndType(picUri, "image/*");
|
|
||||||
// set crop properties
|
|
||||||
cropIntent.putExtra("crop", "true");
|
|
||||||
|
|
||||||
// indicate output X and Y
|
/**
|
||||||
if (targetWidth > 0) {
|
* Brings up the UI to perform crop on passed image URI
|
||||||
cropIntent.putExtra("outputX", targetWidth);
|
*
|
||||||
}
|
* @param picUri
|
||||||
if (targetHeight > 0) {
|
*/
|
||||||
cropIntent.putExtra("outputY", targetHeight);
|
private void performCrop(Uri picUri, int destType, Intent cameraIntent) {
|
||||||
}
|
try {
|
||||||
if (targetHeight > 0 && targetWidth > 0 && targetWidth == targetHeight) {
|
Intent cropIntent = new Intent("com.android.camera.action.CROP");
|
||||||
cropIntent.putExtra("aspectX", 1);
|
// indicate image type and Uri
|
||||||
cropIntent.putExtra("aspectY", 1);
|
cropIntent.setDataAndType(picUri, "image/*");
|
||||||
}
|
// set crop properties
|
||||||
// create new file handle to get full resolution crop
|
cropIntent.putExtra("crop", "true");
|
||||||
croppedUri = Uri.fromFile(createCaptureFile(this.encodingType, System.currentTimeMillis() + ""));
|
|
||||||
cropIntent.putExtra("output", croppedUri);
|
|
||||||
|
|
||||||
// start the activity - we handle returning in onActivityResult
|
// indicate output X and Y
|
||||||
|
if (targetWidth > 0) {
|
||||||
|
cropIntent.putExtra("outputX", targetWidth);
|
||||||
|
}
|
||||||
|
if (targetHeight > 0) {
|
||||||
|
cropIntent.putExtra("outputY", targetHeight);
|
||||||
|
}
|
||||||
|
if (targetHeight > 0 && targetWidth > 0 && targetWidth == targetHeight) {
|
||||||
|
cropIntent.putExtra("aspectX", 1);
|
||||||
|
cropIntent.putExtra("aspectY", 1);
|
||||||
|
}
|
||||||
|
// create new file handle to get full resolution crop
|
||||||
|
croppedUri = Uri.fromFile(createCaptureFile(this.encodingType, System.currentTimeMillis() + ""));
|
||||||
|
cropIntent.putExtra("output", croppedUri);
|
||||||
|
|
||||||
if (this.cordova != null) {
|
// start the activity - we handle returning in onActivityResult
|
||||||
this.cordova.startActivityForResult((CordovaPlugin) this,
|
|
||||||
cropIntent, CROP_CAMERA + destType);
|
if (this.cordova != null) {
|
||||||
}
|
this.cordova.startActivityForResult((CordovaPlugin) this,
|
||||||
} catch (ActivityNotFoundException anfe) {
|
cropIntent, CROP_CAMERA + destType);
|
||||||
Log.e(LOG_TAG, "Crop operation not supported on this device");
|
}
|
||||||
try {
|
} catch (ActivityNotFoundException anfe) {
|
||||||
processResultFromCamera(destType, cameraIntent);
|
Log.e(LOG_TAG, "Crop operation not supported on this device");
|
||||||
}
|
try {
|
||||||
catch (IOException e)
|
processResultFromCamera(destType, cameraIntent);
|
||||||
{
|
}
|
||||||
e.printStackTrace();
|
catch (IOException e)
|
||||||
Log.e(LOG_TAG, "Unable to write to file");
|
{
|
||||||
}
|
e.printStackTrace();
|
||||||
}
|
Log.e(LOG_TAG, "Unable to write to file");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Applies all needed transformation to the image received from the camera.
|
* Applies all needed transformation to the image received from the camera.
|
||||||
@ -451,8 +452,8 @@ public class CameraLauncher extends CordovaPlugin implements MediaScannerConnect
|
|||||||
// Create an ExifHelper to save the exif data that is lost during compression
|
// Create an ExifHelper to save the exif data that is lost during compression
|
||||||
ExifHelper exif = new ExifHelper();
|
ExifHelper exif = new ExifHelper();
|
||||||
String sourcePath = (this.allowEdit && this.croppedUri != null) ?
|
String sourcePath = (this.allowEdit && this.croppedUri != null) ?
|
||||||
FileHelper.stripFileProtocol(this.croppedUri.toString()) :
|
FileHelper.stripFileProtocol(this.croppedUri.toString()) :
|
||||||
FileHelper.stripFileProtocol(this.imageUri.toString());
|
FileHelper.stripFileProtocol(this.imageUri.toString());
|
||||||
|
|
||||||
if (this.encodingType == JPEG) {
|
if (this.encodingType == JPEG) {
|
||||||
try {
|
try {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user