Fixing issue where you can't drag from AllApps.

Change-Id: I61bd966b97d275ece1db238edaac8d66936d0a20
This commit is contained in:
Winson Chung
2011-03-18 16:56:08 -07:00
parent b3bcd60f95
commit 097eb0a751
4 changed files with 37 additions and 27 deletions
+26 -20
View File
@@ -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);
}
}
}
}