You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by st...@apache.org on 2016/08/29 22:05:38 UTC
[3/5] cordova-plugin-camera git commit: Reverted indenting done by
Android Studio
Reverted indenting done by Android Studio
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/commit/e3a431cb
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/tree/e3a431cb
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/diff/e3a431cb
Branch: refs/heads/master
Commit: e3a431cbeb26c6d59f8183147d0086ff36cda525
Parents: 832d6e3
Author: swbradshaw <sw...@gmail.com>
Authored: Thu May 12 21:25:36 2016 -0400
Committer: swbradshaw <sw...@gmail.com>
Committed: Thu May 12 21:25:36 2016 -0400
----------------------------------------------------------------------
src/android/CameraLauncher.java | 93 ++++++++++++++++++------------------
1 file changed, 47 insertions(+), 46 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/blob/e3a431cb/src/android/CameraLauncher.java
----------------------------------------------------------------------
diff --git a/src/android/CameraLauncher.java b/src/android/CameraLauncher.java
index 70ebef9..60b07fe 100644
--- a/src/android/CameraLauncher.java
+++ b/src/android/CameraLauncher.java
@@ -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) {
- 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);
-
- // start the activity - we handle returning in onActivityResult
- if (this.cordova != null) {
- this.cordova.startActivityForResult((CordovaPlugin) this,
- cropIntent, CROP_CAMERA + destType);
- }
- } catch (ActivityNotFoundException anfe) {
- Log.e(LOG_TAG, "Crop operation not supported on this device");
- try {
- processResultFromCamera(destType, cameraIntent);
- }
- catch (IOException e)
- {
- e.printStackTrace();
- Log.e(LOG_TAG, "Unable to write to file");
- }
- }
+ /**
+ * 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) {
+ 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);
+
+ // start the activity - we handle returning in onActivityResult
+
+ if (this.cordova != null) {
+ this.cordova.startActivityForResult((CordovaPlugin) this,
+ cropIntent, CROP_CAMERA + destType);
+ }
+ } catch (ActivityNotFoundException anfe) {
+ Log.e(LOG_TAG, "Crop operation not supported on this device");
+ try {
+ processResultFromCamera(destType, cameraIntent);
+ }
+ catch (IOException e)
+ {
+ e.printStackTrace();
+ Log.e(LOG_TAG, "Unable to write to file");
+ }
}
+ }
/**
* 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
ExifHelper exif = new ExifHelper();
String sourcePath = (this.allowEdit && this.croppedUri != null) ?
- FileHelper.stripFileProtocol(this.croppedUri.toString()) :
- FileHelper.stripFileProtocol(this.imageUri.toString());
+ FileHelper.stripFileProtocol(this.croppedUri.toString()) :
+ FileHelper.stripFileProtocol(this.imageUri.toString());
if (this.encodingType == JPEG) {
try {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org