summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDoris Liu <tianliu@google.com>2013-10-14 20:47:39 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2013-10-14 20:47:39 +0000
commitce75de57dca5398b7786ad7262cb016e5f6b24ee (patch)
treec8e4957ffd18270611311b10c8bc66d1205d9312
parentb27668f0d0a1d5049759a8448e1701e199e05c71 (diff)
parent352b014552d77948193d84ec177c7673552eb1ee (diff)
downloadandroid_packages_apps_Snap-ce75de57dca5398b7786ad7262cb016e5f6b24ee.tar.gz
android_packages_apps_Snap-ce75de57dca5398b7786ad7262cb016e5f6b24ee.tar.bz2
android_packages_apps_Snap-ce75de57dca5398b7786ad7262cb016e5f6b24ee.zip
Merge "Fix SRI upside down preview in reverse landscape and reverse portrait" into gb-ub-photos-carlsbad
-rw-r--r--res/layout/panorama_module.xml5
-rw-r--r--src/com/android/camera/WideAnglePanoramaModule.java5
-rw-r--r--src/com/android/camera/WideAnglePanoramaUI.java29
3 files changed, 31 insertions, 8 deletions
diff --git a/res/layout/panorama_module.xml b/res/layout/panorama_module.xml
index 3711cc67f..0b2785a3e 100644
--- a/res/layout/panorama_module.xml
+++ b/res/layout/panorama_module.xml
@@ -14,8 +14,7 @@
limitations under the License.
-->
-<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/pano_layout"
+<merge xmlns:android="http://schemas.android.com/apk/res/android"
android:clickable="true"
android:layout_width="match_parent"
android:layout_height="match_parent">
@@ -24,4 +23,4 @@
<include layout="@layout/camera_controls"
android:layout_gravity="center"
style="@style/CameraControls"/>
-</FrameLayout>
+</merge>
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;