summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDoris Liu <tianliu@google.com>2013-08-21 18:45:29 -0700
committerDoris Liu <tianliu@google.com>2013-08-21 18:45:29 -0700
commitce2acbcb77225b6d429a23e00f69aadde8c2378b (patch)
tree3fa982889eaf984653061ed44e85e9a07511defd
parentf737ac489200f12b6a48c4d0f7b63c0731eb8713 (diff)
downloadandroid_packages_apps_Snap-ce2acbcb77225b6d429a23e00f69aadde8c2378b.tar.gz
android_packages_apps_Snap-ce2acbcb77225b6d429a23e00f69aadde8c2378b.tar.bz2
android_packages_apps_Snap-ce2acbcb77225b6d429a23e00f69aadde8c2378b.zip
Fix preview thumb orientation
Bug: 10428123 Change-Id: I7c6f37db66d9e10a07f555902b214009156736c1
-rw-r--r--src/com/android/camera/PhotoModule.java5
-rw-r--r--src/com/android/camera/PhotoUI.java17
2 files changed, 15 insertions, 7 deletions
diff --git a/src/com/android/camera/PhotoModule.java b/src/com/android/camera/PhotoModule.java
index 6098d01f3..bb486cb62 100644
--- a/src/com/android/camera/PhotoModule.java
+++ b/src/com/android/camera/PhotoModule.java
@@ -681,9 +681,6 @@ public class PhotoModule
}
if (mIsImageCaptureIntent) {
stopPreview();
- } else {
- // Animate capture with real jpeg data instead of a preview frame.
- mUI.animateCapture(jpegData);
}
if (mSceneMode == CameraUtil.SCENE_MODE_HDR) {
mUI.showSwitcher();
@@ -754,6 +751,8 @@ public class PhotoModule
jpegData, title, date, mLocation, width, height,
orientation, exif, mOnMediaSavedListener, mContentResolver);
}
+ // Animate capture with real jpeg data instead of a preview frame.
+ mUI.animateCapture(jpegData, orientation);
} else {
mJpegImageData = jpegData;
if (!mQuickCapture) {
diff --git a/src/com/android/camera/PhotoUI.java b/src/com/android/camera/PhotoUI.java
index 6157d0f1d..7adb27f90 100644
--- a/src/com/android/camera/PhotoUI.java
+++ b/src/com/android/camera/PhotoUI.java
@@ -147,15 +147,24 @@ public class PhotoUI implements PieListener,
private class DecodeTask extends AsyncTask<Integer, Void, Bitmap> {
private final byte [] mData;
+ private int mOrientation;
- public DecodeTask(byte[] data) {
+ public DecodeTask(byte[] data, int orientation) {
mData = data;
+ mOrientation = orientation;
}
@Override
protected Bitmap doInBackground(Integer... params) {
// Decode image in background.
- return CameraUtil.downSample(mData, DOWN_SAMPLE_FACTOR);
+ Bitmap bitmap = CameraUtil.downSample(mData, DOWN_SAMPLE_FACTOR);
+ if (mOrientation != 0) {
+ Matrix m = new Matrix();
+ m.postRotate(mOrientation);
+ return Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), m,
+ false);
+ }
+ return bitmap;
}
@Override
@@ -299,9 +308,9 @@ public class PhotoUI implements PieListener,
updateOnScreenIndicators(params, prefGroup, prefs);
}
- public void animateCapture(final byte[] jpegData) {
+ public void animateCapture(final byte[] jpegData, int orientation) {
// Decode jpeg byte array and then animate the jpeg
- DecodeTask task = new DecodeTask(jpegData);
+ DecodeTask task = new DecodeTask(jpegData, orientation);
task.execute();
}