diff options
-rw-r--r-- | res/layout/photo_module.xml | 8 | ||||
-rw-r--r-- | src/com/android/camera/PhotoModule.java | 6 | ||||
-rw-r--r-- | src/com/android/camera/PhotoUI.java | 31 |
3 files changed, 39 insertions, 6 deletions
diff --git a/res/layout/photo_module.xml b/res/layout/photo_module.xml index b0bca3c97..b63d53662 100644 --- a/res/layout/photo_module.xml +++ b/res/layout/photo_module.xml @@ -34,6 +34,14 @@ android:layout_width="match_parent" android:layout_height="match_parent" /> </FrameLayout> + <ImageView + android:id="@+id/review_image" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:visibility="gone" + android:clickable="true" + android:background="@android:color/black" + android:scaleType="fitCenter"/> <View android:id="@+id/flash_overlay" android:layout_width="match_parent" 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); |