diff options
author | Winson Chung <winsonc@google.com> | 2011-03-18 16:56:08 -0700 |
---|---|---|
committer | Winson Chung <winsonc@google.com> | 2011-03-21 14:25:45 -0700 |
commit | 097eb0a7511d2a645a32cc9e65a322efa54c08dd (patch) | |
tree | 61af6d46652b67a90bde962b2afceb2fc51b1bfb | |
parent | b3bcd60f9522f28bd20f455b5f248b30848bc4c2 (diff) | |
download | android_packages_apps_Trebuchet-097eb0a7511d2a645a32cc9e65a322efa54c08dd.tar.gz android_packages_apps_Trebuchet-097eb0a7511d2a645a32cc9e65a322efa54c08dd.tar.bz2 android_packages_apps_Trebuchet-097eb0a7511d2a645a32cc9e65a322efa54c08dd.zip |
Fixing issue where you can't drag from AllApps.
Change-Id: I61bd966b97d275ece1db238edaac8d66936d0a20
-rw-r--r-- | src/com/android/launcher2/AllApps2D.java | 6 | ||||
-rw-r--r-- | src/com/android/launcher2/AllApps3D.java | 10 | ||||
-rw-r--r-- | src/com/android/launcher2/Launcher.java | 2 | ||||
-rw-r--r-- | src/com/android/launcher2/Workspace.java | 46 |
4 files changed, 37 insertions, 27 deletions
diff --git a/src/com/android/launcher2/AllApps2D.java b/src/com/android/launcher2/AllApps2D.java index 1cbb99994..329109f2b 100644 --- a/src/com/android/launcher2/AllApps2D.java +++ b/src/com/android/launcher2/AllApps2D.java @@ -143,7 +143,7 @@ public class AllApps2D homeButton.setOnClickListener( new View.OnClickListener() { public void onClick(View v) { - mLauncher.closeAllApps(true); + mLauncher.showWorkspace(true); } }); } @@ -167,7 +167,7 @@ public class AllApps2D switch (keyCode) { case KeyEvent.KEYCODE_BACK: - mLauncher.closeAllApps(true); + mLauncher.showWorkspace(true); break; default: return false; @@ -190,7 +190,7 @@ public class AllApps2D app = new ApplicationInfo(app); mDragController.startDrag(view, this, app, DragController.DRAG_ACTION_COPY); - mLauncher.closeAllApps(true); + mLauncher.showWorkspace(true); return true; } diff --git a/src/com/android/launcher2/AllApps3D.java b/src/com/android/launcher2/AllApps3D.java index 29f49afc2..d42481b13 100644 --- a/src/com/android/launcher2/AllApps3D.java +++ b/src/com/android/launcher2/AllApps3D.java @@ -350,7 +350,7 @@ public class AllApps3D extends RSSurfaceView if (mArrowNavigation) { if (mLastSelection == SELECTION_HOME) { reallyPlaySoundEffect(SoundEffectConstants.CLICK); - mLauncher.closeAllApps(true); + mLauncher.showWorkspace(true); } else { int whichApp = sRollo.mScript.get_gSelectedIconIndex(); if (whichApp >= 0) { @@ -637,7 +637,7 @@ public class AllApps3D extends RSSurfaceView if ((isPortrait && y > mTouchYBorders[mTouchYBorders.length-1]) || (!isPortrait && x > mTouchXBorders[mTouchXBorders.length-1])) { reallyPlaySoundEffect(SoundEffectConstants.CLICK); - mLauncher.closeAllApps(true); + mLauncher.showWorkspace(true); } sRollo.setHomeSelected(SELECTED_NONE); } @@ -691,10 +691,12 @@ public class AllApps3D extends RSSurfaceView int screenX = mMotionDownRawX - (bmp.getWidth() / 2); int screenY = mMotionDownRawY - bmp.getHeight(); + mLauncher.lockScreenOrientation(); + mLauncher.getWorkspace().onDragStartedWithItemSpans(1, 1, bmp); mDragController.startDrag( bmp, screenX, screenY, this, app, DragController.DRAG_ACTION_COPY); - mLauncher.closeAllApps(true); + mLauncher.showWorkspace(true); } return true; } @@ -747,6 +749,8 @@ public class AllApps3D extends RSSurfaceView @Override public void onDropCompleted(View target, Object dragInfo, boolean success) { + mLauncher.getWorkspace().onDragStopped(success); + mLauncher.unlockScreenOrientation(); } /** diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java index d7a360df6..64cbee4ce 100644 --- a/src/com/android/launcher2/Launcher.java +++ b/src/com/android/launcher2/Launcher.java @@ -3106,7 +3106,7 @@ public final class Launcher extends Activity mAllAppsGrid.zoom(0.0f, animated); } ((View)mAllAppsGrid).setFocusable(false); - mWorkspace.getChildAt(mWorkspace.getCurrentPage()).requestFocus(); + ((CellLayout) mWorkspace.getChildAt(mWorkspace.getCurrentPage())).getChildrenLayout().requestFocus(); } } diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java index b5c1074ab..2e202f766 100644 --- a/src/com/android/launcher2/Workspace.java +++ b/src/com/android/launcher2/Workspace.java @@ -1708,26 +1708,32 @@ public class Workspace extends SmoothPagedView for (int i = 0; i < screenCount; i++) { CellLayout cl = (CellLayout) getChildAt(i); cl.setIsDragOccuring(isDragHappening); - switch (state) { - case TOP: - cl.setIsDefaultDropTarget(i == mCurrentPage); - case BOTTOM_HIDDEN: - case BOTTOM_VISIBLE: - case SPRING_LOADED: - if (state != ShrinkState.TOP) { - cl.setIsDefaultDropTarget(false); - } - if (!isDragHappening) { - // even if a drag isn't happening, we don't want to show a screen as - // accepting drops if it doesn't have at least one free cell - spanX = 1; - spanY = 1; - } - // the page accepts drops if we can find at least one empty spot - cl.setAcceptsDrops(cl.findCellForSpan(null, spanX, spanY)); - break; - default: - throw new RuntimeException("Unhandled ShrinkState " + state); + if (state == null) { + // If we are not in a shrunken state, mark all cell layouts as droppable (if they + // have the space) + cl.setAcceptsDrops(cl.findCellForSpan(null, spanX, spanY)); + } else { + switch (state) { + case TOP: + cl.setIsDefaultDropTarget(i == mCurrentPage); + case BOTTOM_HIDDEN: + case BOTTOM_VISIBLE: + case SPRING_LOADED: + if (state != ShrinkState.TOP) { + cl.setIsDefaultDropTarget(false); + } + if (!isDragHappening) { + // even if a drag isn't happening, we don't want to show a screen as + // accepting drops if it doesn't have at least one free cell + spanX = 1; + spanY = 1; + } + // the page accepts drops if we can find at least one empty spot + cl.setAcceptsDrops(cl.findCellForSpan(null, spanX, spanY)); + break; + default: + throw new RuntimeException("Unhandled ShrinkState " + state); + } } } } |