diff options
author | Doris Liu <tianliu@google.com> | 2013-05-06 17:23:09 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2013-05-06 17:23:09 +0000 |
commit | 93240535cafe2b1a7630f8350963a3d84cbb9937 (patch) | |
tree | 232d76013f0ddbd68c74bde8cd5e412eb0687e77 /src/com/android/camera | |
parent | 712cc2f5add2fb78fbb723ecbca5f576a91fb54f (diff) | |
parent | fa1c3a528de2ec357b8f43aa133feae444899668 (diff) | |
download | android_packages_apps_Snap-93240535cafe2b1a7630f8350963a3d84cbb9937.tar.gz android_packages_apps_Snap-93240535cafe2b1a7630f8350963a3d84cbb9937.tar.bz2 android_packages_apps_Snap-93240535cafe2b1a7630f8350963a3d84cbb9937.zip |
Merge "Restrict checking for device flip" into gb-ub-photos-bryce
Diffstat (limited to 'src/com/android/camera')
-rw-r--r-- | src/com/android/camera/ui/CameraControls.java | 25 | ||||
-rw-r--r-- | src/com/android/camera/ui/RotatableLayout.java | 2 |
2 files changed, 20 insertions, 7 deletions
diff --git a/src/com/android/camera/ui/CameraControls.java b/src/com/android/camera/ui/CameraControls.java index 5d2f12360..1fc83fdf4 100644 --- a/src/com/android/camera/ui/CameraControls.java +++ b/src/com/android/camera/ui/CameraControls.java @@ -62,12 +62,7 @@ public class CameraControls extends RotatableLayout { @Override public void onDisplayChanged(int arg0) { - int currentRotation = Util.getDisplayRotation((Activity) getContext()); - if ((currentRotation - mLastRotation) % 180 == 0) { - flipChildren(); - getParent().requestLayout(); - } - mLastRotation = currentRotation; + checkLayoutFlip(); } @Override @@ -76,6 +71,15 @@ public class CameraControls extends RotatableLayout { } } + private void checkLayoutFlip() { + int currentRotation = Util.getDisplayRotation((Activity) getContext()); + if ((currentRotation - mLastRotation + 360) % 360 == 180) { + mLastRotation = currentRotation; + flipChildren(); + getParent().requestLayout(); + } + } + @Override public void onFinishInflate() { super.onFinishInflate(); @@ -99,6 +103,14 @@ public class CameraControls extends RotatableLayout { } @Override + public void onWindowVisibilityChanged(int visibility) { + if (visibility == View.VISIBLE) { + // Make sure when coming back from onPause, the layout is rotated correctly + checkLayoutFlip(); + } + } + + @Override public void onDetachedFromWindow () { super.onDetachedFromWindow(); if (ApiHelper.HAS_DISPLAY_LISTENER) { @@ -109,6 +121,7 @@ public class CameraControls extends RotatableLayout { @Override public void onLayout(boolean changed, int l, int t, int r, int b) { + mLastRotation = Util.getDisplayRotation((Activity) getContext()); int orientation = getResources().getConfiguration().orientation; int size = getResources().getDimensionPixelSize(R.dimen.camera_controls_size); int rotation = getUnifiedRotation(); diff --git a/src/com/android/camera/ui/RotatableLayout.java b/src/com/android/camera/ui/RotatableLayout.java index 2dea58d9d..8355c8826 100644 --- a/src/com/android/camera/ui/RotatableLayout.java +++ b/src/com/android/camera/ui/RotatableLayout.java @@ -82,7 +82,7 @@ public class RotatableLayout extends FrameLayout { super.onConfigurationChanged(config); int rotation = Util.getDisplayRotation((Activity) getContext()); if ((rotation - mPrevRotation + 360) % 180 == 0) { - flipChildren(); + mPrevRotation = rotation; return; } boolean clockwise = isClockWiseRotation(mPrevRotation, rotation); |