summaryrefslogtreecommitdiffstats
path: root/src/com
diff options
context:
space:
mode:
authorDoris Liu <tianliu@google.com>2013-10-14 12:06:20 -0700
committerDoris Liu <tianliu@google.com>2013-10-14 12:06:20 -0700
commit352b014552d77948193d84ec177c7673552eb1ee (patch)
treefd6023c568c1ae31cb2047a334b4094065c99291 /src/com
parentae1697302b4ef59bbfebdf1127bc73531ce550b7 (diff)
downloadandroid_packages_apps_Snap-352b014552d77948193d84ec177c7673552eb1ee.tar.gz
android_packages_apps_Snap-352b014552d77948193d84ec177c7673552eb1ee.tar.bz2
android_packages_apps_Snap-352b014552d77948193d84ec177c7673552eb1ee.zip
Fix SRI upside down preview in reverse landscape and reverse portrait
Also make sure preview is not upside down after device flip, and fix camera controls jiggering during rotation Bug: 11216647 Bug: 11174540 Change-Id: I764e5b86549fa87c2224d8e85ff06f57f0a315d1
Diffstat (limited to 'src/com')
-rw-r--r--src/com/android/camera/WideAnglePanoramaModule.java5
-rw-r--r--src/com/android/camera/WideAnglePanoramaUI.java29
2 files changed, 29 insertions, 5 deletions
diff --git a/src/com/android/camera/WideAnglePanoramaModule.java b/src/com/android/camera/WideAnglePanoramaModule.java
index 189bf99d1..91c3049c6 100644
--- a/src/com/android/camera/WideAnglePanoramaModule.java
+++ b/src/com/android/camera/WideAnglePanoramaModule.java
@@ -454,7 +454,7 @@ public class WideAnglePanoramaModule
final boolean isLandscape =
(mActivity.getResources().getConfiguration().orientation ==
Configuration.ORIENTATION_LANDSCAPE);
-
+ mUI.flipPreviewIfNeeded();
MosaicPreviewRenderer renderer = new MosaicPreviewRenderer(
mUI.getSurfaceTexture(),
mPreviewUIWidth, mPreviewUIHeight, isLandscape);
@@ -819,6 +819,7 @@ public class WideAnglePanoramaModule
mWaitProcessorTask = null;
}
resetScreenOn();
+ mUI.removeDisplayChangeListener();
if (mSoundPlayer != null) {
mSoundPlayer.release();
mSoundPlayer = null;
@@ -879,7 +880,7 @@ public class WideAnglePanoramaModule
boolean recordLocation = RecordLocationPreference.get(mPreferences,
mContentResolver);
mLocationManager.recordLocation(recordLocation);
-
+ mUI.initDisplayChangeListener();
UsageStatistics.onContentViewChanged(
UsageStatistics.COMPONENT_CAMERA, "PanoramaModule");
}
diff --git a/src/com/android/camera/WideAnglePanoramaUI.java b/src/com/android/camera/WideAnglePanoramaUI.java
index 407160933..202303091 100644
--- a/src/com/android/camera/WideAnglePanoramaUI.java
+++ b/src/com/android/camera/WideAnglePanoramaUI.java
@@ -43,6 +43,7 @@ import android.widget.TextView;
import com.android.camera.ui.CameraControls;
import com.android.camera.ui.CameraRootView;
import com.android.camera.ui.ModuleSwitcher;
+import com.android.camera.util.CameraUtil;
import com.android.camera2.R;
/**
@@ -51,6 +52,7 @@ import com.android.camera2.R;
public class WideAnglePanoramaUI implements
TextureView.SurfaceTextureListener,
ShutterButton.OnShutterButtonListener,
+ CameraRootView.MyDisplayListener,
View.OnLayoutChangeListener {
@SuppressWarnings("unused")
@@ -61,7 +63,6 @@ public class WideAnglePanoramaUI implements
private ViewGroup mRootView;
private ModuleSwitcher mSwitcher;
- private ViewGroup mPanoLayout;
private FrameLayout mCaptureLayout;
private View mReviewLayout;
private ImageView mReview;
@@ -274,7 +275,7 @@ public class WideAnglePanoramaUI implements
mReviewControl.removeAllViews();
inflater.inflate(R.layout.pano_review_control, mReviewControl, true);
- mPanoLayout.bringChildToFront(mCameraControls);
+ mRootView.bringChildToFront(mCameraControls);
setViews(mActivity.getResources());
if (threadRunning) {
mReview.setImageDrawable(lowResReview);
@@ -333,7 +334,6 @@ public class WideAnglePanoramaUI implements
mReviewBackground = appRes.getColor(R.color.review_background);
mIndicatorColorFast = appRes.getColor(R.color.pano_progress_indication_fast);
- mPanoLayout = (ViewGroup) mRootView.findViewById(R.id.pano_layout);
mPreviewLayout = mRootView.findViewById(R.id.pano_preview_layout);
mReviewControl = (ViewGroup) mRootView.findViewById(R.id.pano_review_control);
mReviewLayout = mRootView.findViewById(R.id.pano_review_layout);
@@ -418,6 +418,29 @@ public class WideAnglePanoramaUI implements
mRightIndicator.setEnabled(false);
}
+ public void flipPreviewIfNeeded() {
+ if (CameraUtil.getDisplayRotation(mActivity) >= 180) {
+ // In either reverse landscape or reverse portrait
+ mTextureView.setRotation(180);
+ } else {
+ mTextureView.setRotation(0);
+ }
+ }
+
+ @Override
+ public void onDisplayChanged() {
+ mCameraControls.checkLayoutFlip();
+ flipPreviewIfNeeded();
+ }
+
+ public void initDisplayChangeListener() {
+ ((CameraRootView) mRootView).setDisplayChangeListener(this);
+ }
+
+ public void removeDisplayChangeListener() {
+ ((CameraRootView) mRootView).removeDisplayChangeListener();
+ }
+
private class DialogHelper {
private ProgressDialog mProgressDialog;
private AlertDialog mAlertDialog;