summaryrefslogtreecommitdiffstats
path: root/src/com/android/camera
diff options
context:
space:
mode:
authorDoris Liu <tianliu@google.com>2013-09-11 17:38:08 -0700
committerDoris Liu <tianliu@google.com>2013-09-11 17:42:09 -0700
commit36e56fba281292255a01ee00b4bee067fa09ab59 (patch)
tree0bc586061ce7e31ff434e5d80ba304c5834b3130 /src/com/android/camera
parent7b265a6b2f55c6ae7afc30e63ba324c4084a5d8e (diff)
downloadandroid_packages_apps_Snap-36e56fba281292255a01ee00b4bee067fa09ab59.tar.gz
android_packages_apps_Snap-36e56fba281292255a01ee00b4bee067fa09ab59.tar.bz2
android_packages_apps_Snap-36e56fba281292255a01ee00b4bee067fa09ab59.zip
Show captured image rather than frozen preview for capture intent
Bug: 10570887 Change-Id: Ie986c865bdf452973b833efcdcb397c27bef2420
Diffstat (limited to 'src/com/android/camera')
-rw-r--r--src/com/android/camera/PhotoModule.java6
-rw-r--r--src/com/android/camera/PhotoUI.java31
2 files changed, 31 insertions, 6 deletions
diff --git a/src/com/android/camera/PhotoModule.java b/src/com/android/camera/PhotoModule.java
index 789446dcd..d00da1935 100644
--- a/src/com/android/camera/PhotoModule.java
+++ b/src/com/android/camera/PhotoModule.java
@@ -722,11 +722,11 @@ public class PhotoModule
}
}
+ ExifInterface exif = Exif.getExif(jpegData);
+ int orientation = Exif.getOrientation(exif);
if (!mIsImageCaptureIntent) {
// Calculate the width and the height of the jpeg.
Size s = mParameters.getPictureSize();
- ExifInterface exif = Exif.getExif(jpegData);
- int orientation = Exif.getOrientation(exif);
int width, height;
if ((mJpegRotation + orientation) % 180 == 0) {
width = s.width;
@@ -761,7 +761,7 @@ public class PhotoModule
} else {
mJpegImageData = jpegData;
if (!mQuickCapture) {
- mUI.showPostCaptureAlert();
+ mUI.showCapturedImageForReview(jpegData, orientation, mMirror);
} else {
onCaptureDone();
}
diff --git a/src/com/android/camera/PhotoUI.java b/src/com/android/camera/PhotoUI.java
index de555485c..41847ed1c 100644
--- a/src/com/android/camera/PhotoUI.java
+++ b/src/com/android/camera/PhotoUI.java
@@ -85,6 +85,8 @@ public class PhotoUI implements PieListener,
private View mReviewCancelButton;
private View mReviewDoneButton;
private View mReviewRetakeButton;
+ private ImageView mReviewImage;
+ private DecodeImageForReview mDecodeTaskForReview = null;
private View mMenuButton;
private PhotoMenu mMenu;
@@ -141,7 +143,7 @@ public class PhotoUI implements PieListener,
}
};
- private class DecodeTask extends AsyncTask<Integer, Void, Bitmap> {
+ private class DecodeTask extends AsyncTask<Void, Void, Bitmap> {
private final byte [] mData;
private int mOrientation;
private boolean mMirror;
@@ -153,7 +155,7 @@ public class PhotoUI implements PieListener,
}
@Override
- protected Bitmap doInBackground(Integer... params) {
+ protected Bitmap doInBackground(Void... params) {
// Decode image in background.
Bitmap bitmap = CameraUtil.downSample(mData, DOWN_SAMPLE_FACTOR);
if (mOrientation != 0 || mMirror) {
@@ -176,6 +178,22 @@ public class PhotoUI implements PieListener,
}
}
+ private class DecodeImageForReview extends DecodeTask {
+ public DecodeImageForReview(byte[] data, int orientation, boolean mirror) {
+ super(data, orientation, mirror);
+ }
+
+ @Override
+ protected void onPostExecute(Bitmap bitmap) {
+ if (isCancelled()) {
+ return;
+ }
+ mReviewImage.setImageBitmap(bitmap);
+ mReviewImage.setVisibility(View.VISIBLE);
+ mDecodeTaskForReview = null;
+ }
+ }
+
public PhotoUI(CameraActivity activity, PhotoController controller, View parent) {
mActivity = activity;
mController = controller;
@@ -351,6 +369,7 @@ public class PhotoUI implements PieListener,
mReviewDoneButton = mRootView.findViewById(R.id.btn_done);
mReviewCancelButton = mRootView.findViewById(R.id.btn_cancel);
mReviewRetakeButton = mRootView.findViewById(R.id.btn_retake);
+ mReviewImage = (ImageView) mRootView.findViewById(R.id.review_image);
mReviewCancelButton.setVisibility(View.VISIBLE);
mReviewDoneButton.setOnClickListener(new OnClickListener() {
@@ -598,7 +617,9 @@ public class PhotoUI implements PieListener,
return ret;
}
- protected void showPostCaptureAlert() {
+ protected void showCapturedImageForReview(byte[] jpegData, int orientation, boolean mirror) {
+ mDecodeTaskForReview = new DecodeImageForReview(jpegData, orientation, mirror);
+ mDecodeTaskForReview.execute();
mOnScreenIndicators.setVisibility(View.GONE);
mMenuButton.setVisibility(View.GONE);
CameraUtil.fadeIn(mReviewDoneButton);
@@ -608,6 +629,10 @@ public class PhotoUI implements PieListener,
}
protected void hidePostCaptureAlert() {
+ if (mDecodeTaskForReview != null) {
+ mDecodeTaskForReview.cancel(true);
+ }
+ mReviewImage.setVisibility(View.GONE);
mOnScreenIndicators.setVisibility(View.VISIBLE);
mMenuButton.setVisibility(View.VISIBLE);
CameraUtil.fadeOut(mReviewDoneButton);