diff options
author | John Reck <jreck@google.com> | 2012-10-10 09:58:10 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2012-10-10 09:58:10 -0700 |
commit | f3cb78405bd304ec9062a66dfb615c049ff71caa (patch) | |
tree | 5d34156c36a925b63bb997b99e5722637825c0c6 /src | |
parent | 5d5e7ca7921542eadbb4d1a123125a2676efddca (diff) | |
parent | 8ebbec16fe3de9a08fb7d761b9ce123ce5b9b03d (diff) | |
download | android_packages_apps_Snap-f3cb78405bd304ec9062a66dfb615c049ff71caa.tar.gz android_packages_apps_Snap-f3cb78405bd304ec9062a66dfb615c049ff71caa.tar.bz2 android_packages_apps_Snap-f3cb78405bd304ec9062a66dfb615c049ff71caa.zip |
am eece6da4: Support REVERSE in lockOrientation
* commit 'eece6da4d344f7e1e937130c0d36cef8ef9dbe0c':
Support REVERSE in lockOrientation
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/gallery3d/app/OrientationManager.java | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/com/android/gallery3d/app/OrientationManager.java b/src/com/android/gallery3d/app/OrientationManager.java index f5cbf06c6..a8ef99ad8 100644 --- a/src/com/android/gallery3d/app/OrientationManager.java +++ b/src/com/android/gallery3d/app/OrientationManager.java @@ -98,13 +98,19 @@ public class OrientationManager implements OrientationSource { public void lockOrientation() { if (mOrientationLocked) return; mOrientationLocked = true; + // Display rotation >= 180 means we need to use the REVERSE landscape/portrait + boolean standard = getDisplayRotation() < 180; if (mActivity.getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) { Log.d(TAG, "lock orientation to landscape"); - mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); + mActivity.setRequestedOrientation(standard + ? ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE + : ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE); } else { Log.d(TAG, "lock orientation to portrait"); - mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); + mActivity.setRequestedOrientation(standard + ? ActivityInfo.SCREEN_ORIENTATION_PORTRAIT + : ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT); } updateCompensation(); } |