summaryrefslogtreecommitdiffstats
path: root/src/com/android/gallery3d/app/OrientationManager.java
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2012-10-10 09:44:48 -0700
committerJohn Reck <jreck@google.com>2012-10-10 09:44:48 -0700
commiteece6da4d344f7e1e937130c0d36cef8ef9dbe0c (patch)
tree5685ef9c8322ca8fb466523cb1d4ac6e212aaf22 /src/com/android/gallery3d/app/OrientationManager.java
parent866ed7abd7960efc7986a3624414a730e17f33a6 (diff)
downloadandroid_packages_apps_Gallery2-eece6da4d344f7e1e937130c0d36cef8ef9dbe0c.tar.gz
android_packages_apps_Gallery2-eece6da4d344f7e1e937130c0d36cef8ef9dbe0c.tar.bz2
android_packages_apps_Gallery2-eece6da4d344f7e1e937130c0d36cef8ef9dbe0c.zip
Support REVERSE in lockOrientation
Bug: 7314703 Change-Id: Id459e49496f562e75c1485d9d717daa28020a587
Diffstat (limited to 'src/com/android/gallery3d/app/OrientationManager.java')
-rw-r--r--src/com/android/gallery3d/app/OrientationManager.java10
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();
}