diff options
author | John Reck <jreck@google.com> | 2012-10-11 10:09:02 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2012-10-11 10:09:02 -0700 |
commit | 1cd69ac342b927d254af2e4ddaa7e7c71a41855e (patch) | |
tree | 7b779d20c63185fa2e2a2fea37b1deb6e759e5fe | |
parent | 97d570264c56dc7eaf50ce30d4a948e12b14b7f2 (diff) | |
parent | 031055b7841a8c886c55860597fb3f426067b5a2 (diff) | |
download | android_packages_apps_Snap-1cd69ac342b927d254af2e4ddaa7e7c71a41855e.tar.gz android_packages_apps_Snap-1cd69ac342b927d254af2e4ddaa7e7c71a41855e.tar.bz2 android_packages_apps_Snap-1cd69ac342b927d254af2e4ddaa7e7c71a41855e.zip |
am 5cca8b99: Fix portrait orientation on landscape devices
* commit '5cca8b99bebe6a9fbb191a8e1364b81e309a1390':
Fix portrait orientation on landscape devices
-rw-r--r-- | src/com/android/gallery3d/app/OrientationManager.java | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/com/android/gallery3d/app/OrientationManager.java b/src/com/android/gallery3d/app/OrientationManager.java index a8ef99ad8..0e033ebe4 100644 --- a/src/com/android/gallery3d/app/OrientationManager.java +++ b/src/com/android/gallery3d/app/OrientationManager.java @@ -98,8 +98,9 @@ public class OrientationManager implements OrientationSource { public void lockOrientation() { if (mOrientationLocked) return; mOrientationLocked = true; + int displayRotation = getDisplayRotation(); // Display rotation >= 180 means we need to use the REVERSE landscape/portrait - boolean standard = getDisplayRotation() < 180; + boolean standard = displayRotation < 180; if (mActivity.getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) { Log.d(TAG, "lock orientation to landscape"); @@ -107,6 +108,13 @@ public class OrientationManager implements OrientationSource { ? ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE : ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE); } else { + if (displayRotation == 90 || displayRotation == 270) { + // If displayRotation = 90 or 270 then we are on a landscape + // device. On landscape devices, portrait is a 90 degree + // clockwise rotation from landscape, so we need + // to flip which portrait we pick as display rotation is counter clockwise + standard = !standard; + } Log.d(TAG, "lock orientation to portrait"); mActivity.setRequestedOrientation(standard ? ActivityInfo.SCREEN_ORIENTATION_PORTRAIT |