summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Cohen <adamcohen@google.com>2011-09-15 18:21:21 -0700
committerAdam Cohen <adamcohen@google.com>2011-09-15 20:08:40 -0700
commit446e940fc8839173de12f1299b8c24f318d53a3f (patch)
treed1f8556c4c9e62aa29c02c037fbab9d206600270
parentc3665faf4525de78c64e1a98106e12f1c23810c9 (diff)
downloadandroid_packages_apps_Trebuchet-446e940fc8839173de12f1299b8c24f318d53a3f.tar.gz
android_packages_apps_Trebuchet-446e940fc8839173de12f1299b8c24f318d53a3f.tar.bz2
android_packages_apps_Trebuchet-446e940fc8839173de12f1299b8c24f318d53a3f.zip
Locking orientation on phones (issue 4967793)
Change-Id: I6b5fe63547f43c408feea75f35dc0a08d06c258c
-rw-r--r--AndroidManifest.xml3
-rw-r--r--src/com/android/launcher2/AppsCustomizePagedView.java4
-rw-r--r--src/com/android/launcher2/Launcher.java28
-rw-r--r--src/com/android/launcher2/Workspace.java4
4 files changed, 25 insertions, 14 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 8382977c3..cfdfe3c21 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 6640f045f..b208e884f 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 28fdb90d3..c3edb9974 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 156d57e37..f61f7e7c2 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();
}
/**