Merge "Preventing activity from rotating while the user is dragging an item. (Bug 6240922)" into jb-dev

This commit is contained in:
Winson Chung
2012-04-26 16:29:56 -07:00
committed by Android (Google) Code Review
3 changed files with 13 additions and 17 deletions
@@ -706,7 +706,7 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
// Start the drag
alphaClipPaint = null;
mLauncher.lockScreenOrientationOnLargeUI();
mLauncher.lockScreenOrientation();
mLauncher.getWorkspace().onDragStartedWithItem(createItemInfo, outline, alphaClipPaint);
mDragController.startDrag(image, preview, this, createItemInfo,
DragController.DRAG_ACTION_COPY, null, scale);
@@ -758,7 +758,7 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
// drop in Workspace
mLauncher.exitSpringLoadedDragMode();
}
mLauncher.unlockScreenOrientationOnLargeUI();
mLauncher.unlockScreenOrientation();
}
@Override
+9 -13
View File
@@ -3316,20 +3316,16 @@ public final class Launcher extends Activity
return oriMap[(d.getRotation() + indexOffset) % 4];
}
public void lockScreenOrientationOnLargeUI() {
if (LauncherApplication.isScreenLarge()) {
setRequestedOrientation(mapConfigurationOriActivityInfoOri(getResources()
.getConfiguration().orientation));
}
public void lockScreenOrientation() {
setRequestedOrientation(mapConfigurationOriActivityInfoOri(getResources()
.getConfiguration().orientation));
}
public void unlockScreenOrientationOnLargeUI() {
if (LauncherApplication.isScreenLarge()) {
mHandler.postDelayed(new Runnable() {
public void run() {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
}
}, mRestoreScreenOrientationDelay);
}
public void unlockScreenOrientation() {
mHandler.postDelayed(new Runnable() {
public void run() {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
}
}, mRestoreScreenOrientationDelay);
}
/* Cling related */
+2 -2
View File
@@ -375,13 +375,13 @@ public class Workspace extends SmoothPagedView
public void onDragStart(DragSource source, Object info, int dragAction) {
mIsDragOccuring = true;
updateChildrenLayersEnabled();
mLauncher.lockScreenOrientationOnLargeUI();
mLauncher.lockScreenOrientation();
}
public void onDragEnd() {
mIsDragOccuring = false;
updateChildrenLayersEnabled();
mLauncher.unlockScreenOrientationOnLargeUI();
mLauncher.unlockScreenOrientation();
}
/**