diff options
author | Adam Cohen <adamcohen@google.com> | 2011-09-15 18:21:21 -0700 |
---|---|---|
committer | Adam Cohen <adamcohen@google.com> | 2011-09-15 20:08:40 -0700 |
commit | 446e940fc8839173de12f1299b8c24f318d53a3f (patch) | |
tree | d1f8556c4c9e62aa29c02c037fbab9d206600270 | |
parent | c3665faf4525de78c64e1a98106e12f1c23810c9 (diff) | |
download | packages_apps_trebuchet-446e940fc8839173de12f1299b8c24f318d53a3f.zip packages_apps_trebuchet-446e940fc8839173de12f1299b8c24f318d53a3f.tar.gz packages_apps_trebuchet-446e940fc8839173de12f1299b8c24f318d53a3f.tar.bz2 |
Locking orientation on phones (issue 4967793)
Change-Id: I6b5fe63547f43c408feea75f35dc0a08d06c258c
-rw-r--r-- | AndroidManifest.xml | 3 | ||||
-rw-r--r-- | src/com/android/launcher2/AppsCustomizePagedView.java | 4 | ||||
-rw-r--r-- | src/com/android/launcher2/Launcher.java | 28 | ||||
-rw-r--r-- | src/com/android/launcher2/Workspace.java | 4 |
4 files changed, 25 insertions, 14 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 8382977..cfdfe3c 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -75,7 +75,8 @@ android:clearTaskOnLaunch="true" android:stateNotNeeded="true" android:theme="@style/Theme" - android:windowSoftInputMode="adjustPan"> + android:windowSoftInputMode="adjustPan" + android:screenOrientation="nosensor"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.HOME" /> diff --git a/src/com/android/launcher2/AppsCustomizePagedView.java b/src/com/android/launcher2/AppsCustomizePagedView.java index 6640f04..b208e88 100644 --- a/src/com/android/launcher2/AppsCustomizePagedView.java +++ b/src/com/android/launcher2/AppsCustomizePagedView.java @@ -524,7 +524,7 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen } // Start the drag - mLauncher.lockScreenOrientation(); + mLauncher.lockScreenOrientationOnLargeUI(); mLauncher.getWorkspace().onDragStartedWithItemSpans(createItemInfo.spanX, createItemInfo.spanY, b); mDragController.startDrag(image, b, this, createItemInfo, @@ -553,7 +553,7 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen // drop in Workspace mLauncher.exitSpringLoadedDragMode(); } - mLauncher.unlockScreenOrientation(); + mLauncher.unlockScreenOrientationOnLargeUI(); } diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java index 28fdb90..c3edb99 100644 --- a/src/com/android/launcher2/Launcher.java +++ b/src/com/android/launcher2/Launcher.java @@ -321,6 +321,11 @@ public final class Launcher extends Activity if (sAppMarketIcon[coi] != null) { updateAppMarketIcon(sAppMarketIcon[coi]); } + + // On large interfaces, we want the screen to auto-rotate based on the current orientation + if (LauncherApplication.isScreenLarge()) { + setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED); + } } private void checkForLocaleChange() { @@ -3040,16 +3045,21 @@ public final class Launcher extends Activity } return oriMap[(d.getRotation() + indexOffset) % 4]; } - public void lockScreenOrientation() { - setRequestedOrientation(mapConfigurationOriActivityInfoOri(getResources() - .getConfiguration().orientation)); + + public void lockScreenOrientationOnLargeUI() { + if (LauncherApplication.isScreenLarge()) { + setRequestedOrientation(mapConfigurationOriActivityInfoOri(getResources() + .getConfiguration().orientation)); + } } - public void unlockScreenOrientation() { - mHandler.postDelayed(new Runnable() { - public void run() { - setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED); - } - }, mRestoreScreenOrientationDelay); + public void unlockScreenOrientationOnLargeUI() { + if (LauncherApplication.isScreenLarge()) { + mHandler.postDelayed(new Runnable() { + public void run() { + setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED); + } + }, mRestoreScreenOrientationDelay); + } } /* Cling related */ diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java index 156d57e..f61f7e7 100644 --- a/src/com/android/launcher2/Workspace.java +++ b/src/com/android/launcher2/Workspace.java @@ -315,13 +315,13 @@ public class Workspace extends SmoothPagedView public void onDragStart(DragSource source, Object info, int dragAction) { mIsDragOccuring = true; updateChildrenLayersEnabled(); - mLauncher.lockScreenOrientation(); + mLauncher.lockScreenOrientationOnLargeUI(); } public void onDragEnd() { mIsDragOccuring = false; updateChildrenLayersEnabled(); - mLauncher.unlockScreenOrientation(); + mLauncher.unlockScreenOrientationOnLargeUI(); } /** |