mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-27 15:26:58 +00:00
Locking orientation on phones (issue 4967793)
Change-Id: I6b5fe63547f43c408feea75f35dc0a08d06c258c
This commit is contained in:
@@ -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" />
|
||||
|
||||
@@ -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();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -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,17 +3045,22 @@ public final class Launcher extends Activity
|
||||
}
|
||||
return oriMap[(d.getRotation() + indexOffset) % 4];
|
||||
}
|
||||
public void lockScreenOrientation() {
|
||||
|
||||
public void lockScreenOrientationOnLargeUI() {
|
||||
if (LauncherApplication.isScreenLarge()) {
|
||||
setRequestedOrientation(mapConfigurationOriActivityInfoOri(getResources()
|
||||
.getConfiguration().orientation));
|
||||
}
|
||||
public void unlockScreenOrientation() {
|
||||
}
|
||||
public void unlockScreenOrientationOnLargeUI() {
|
||||
if (LauncherApplication.isScreenLarge()) {
|
||||
mHandler.postDelayed(new Runnable() {
|
||||
public void run() {
|
||||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
|
||||
}
|
||||
}, mRestoreScreenOrientationDelay);
|
||||
}
|
||||
}
|
||||
|
||||
/* Cling related */
|
||||
private static final String WORKSPACE_CLING_DISMISSED_KEY = "cling.workspace.dismissed";
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user