am b17e140a: Merge "Ensure drag outline & crosshairs disappear on drag cancel" into honeycomb

* commit 'b17e140a07039604a33209ad2555a5586565cd37':
  Ensure drag outline & crosshairs disappear on drag cancel
This commit is contained in:
Patrick Dubroy
2011-01-20 17:05:22 -08:00
committed by Android Git Automerger
3 changed files with 16 additions and 7 deletions
+1 -3
View File
@@ -1342,9 +1342,7 @@ public class CellLayout extends ViewGroup implements VisibilityChangedListener {
lp.isDragging = false;
lp.dropped = true;
lp.animateDrop = animate;
if (animate) {
child.setVisibility(View.INVISIBLE);
}
child.setVisibility(animate ? View.INVISIBLE : View.VISIBLE);
child.requestLayout();
}
}
@@ -399,6 +399,7 @@ public class DragController {
*/
public void cancelDrag() {
if (mDragging) {
// Should we also be calling onDragExit() here?
mDragSource.onDropCompleted(null, false);
}
endDrag();
+14 -4
View File
@@ -2398,8 +2398,7 @@ public class Workspace extends SmoothPagedView
}
}
public void onDragExit(DragSource source, int x, int y, int xOffset,
int yOffset, DragView dragView, Object dragInfo) {
private void doDragExit() {
mWasSpringLoadedOnDragExit = mShrinkState == ShrinkState.SPRING_LOADED;
if (mDragTargetLayout != null) {
mDragTargetLayout.onDragExit();
@@ -2413,6 +2412,11 @@ public class Workspace extends SmoothPagedView
clearAllHovers();
}
public void onDragExit(DragSource source, int x, int y, int xOffset,
int yOffset, DragView dragView, Object dragInfo) {
doDragExit();
}
@Override
public void getHitRect(Rect outRect) {
// We want the workspace to have the whole area of the display (it will find the correct
@@ -2560,6 +2564,9 @@ public class Workspace extends SmoothPagedView
mDragController = dragController;
}
/**
* Called at the end of a drag which originated on the workspace.
*/
public void onDropCompleted(View target, boolean success) {
if (success) {
if (target != this && mDragInfo != null) {
@@ -2571,8 +2578,11 @@ public class Workspace extends SmoothPagedView
// final Object tag = mDragInfo.cell.getTag();
}
} else if (mDragInfo != null) {
boolean animateDrop = !mWasSpringLoadedOnDragExit;
((CellLayout) getChildAt(mDragInfo.screen)).onDropChild(mDragInfo.cell, animateDrop);
// NOTE: When 'success' is true, onDragExit is called by the DragController before
// calling onDropCompleted(). We call it ourselves here, but maybe this should be
// moved into DragController.cancelDrag().
doDragExit();
((CellLayout) getChildAt(mDragInfo.screen)).onDropChild(mDragInfo.cell, false);
}
mLauncher.unlockScreenOrientation();
mDragOutline = null;