summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPatrick Dubroy <dubroy@google.com>2011-01-20 10:43:40 -0800
committerPatrick Dubroy <dubroy@google.com>2011-01-20 12:31:29 -0800
commite3887cc4ec3cebda2333298e56a35acb49ccdf13 (patch)
tree3a7800821cc909b18d5a5951db0faee064414ae7 /src
parent8d60f2c2046725bce89628ee87032326c2551e46 (diff)
downloadandroid_packages_apps_Trebuchet-e3887cc4ec3cebda2333298e56a35acb49ccdf13.tar.gz
android_packages_apps_Trebuchet-e3887cc4ec3cebda2333298e56a35acb49ccdf13.tar.bz2
android_packages_apps_Trebuchet-e3887cc4ec3cebda2333298e56a35acb49ccdf13.zip
Ensure drag outline & crosshairs disappear on drag cancel
Change-Id: I165d45846c0bfe74eda0d61b55e5b93fbfccdef2
Diffstat (limited to 'src')
-rw-r--r--src/com/android/launcher2/CellLayout.java4
-rw-r--r--src/com/android/launcher2/DragController.java1
-rw-r--r--src/com/android/launcher2/Workspace.java18
3 files changed, 16 insertions, 7 deletions
diff --git a/src/com/android/launcher2/CellLayout.java b/src/com/android/launcher2/CellLayout.java
index af2f984b4..02ee950f9 100644
--- a/src/com/android/launcher2/CellLayout.java
+++ b/src/com/android/launcher2/CellLayout.java
@@ -1356,9 +1356,7 @@ public class CellLayout extends ViewGroup implements Dimmable, VisibilityChanged
lp.isDragging = false;
lp.dropped = true;
lp.animateDrop = animate;
- if (animate) {
- child.setVisibility(View.INVISIBLE);
- }
+ child.setVisibility(animate ? View.INVISIBLE : View.VISIBLE);
child.requestLayout();
}
}
diff --git a/src/com/android/launcher2/DragController.java b/src/com/android/launcher2/DragController.java
index b45603094..45b359dc5 100644
--- a/src/com/android/launcher2/DragController.java
+++ b/src/com/android/launcher2/DragController.java
@@ -399,6 +399,7 @@ public class DragController {
*/
public void cancelDrag() {
if (mDragging) {
+ // Should we also be calling onDragExit() here?
mDragSource.onDropCompleted(null, false);
}
endDrag();
diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java
index b248dd68f..56055d9bc 100644
--- a/src/com/android/launcher2/Workspace.java
+++ b/src/com/android/launcher2/Workspace.java
@@ -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;