Prevent flicker when starting a drag.

Also, animate item the view to its new position when dragging.
This commit is contained in:
Patrick Dubroy
2010-11-23 14:40:33 -08:00
parent 2f5590d98e
commit a669d79d0d
11 changed files with 116 additions and 42 deletions
+7 -3
View File
@@ -1360,7 +1360,6 @@ public class Workspace extends SmoothPagedView
CellLayout current = getCurrentDropLayout();
current.onDragChild(child);
child.setVisibility(View.GONE);
child.clearFocus();
child.setPressed(false);
@@ -1406,8 +1405,8 @@ public class Workspace extends SmoothPagedView
// Based on the position of the drag view, find the top left of the original view
int viewX = dragViewX + (dragView.getWidth() - child.getWidth()) / 2;
int viewY = dragViewY + (dragView.getHeight() - child.getHeight()) / 2;
viewX -= getResources().getInteger(R.integer.config_dragViewOffsetX);
viewY -= getResources().getInteger(R.integer.config_dragViewOffsetY);
viewX += getResources().getInteger(R.integer.config_dragViewOffsetX);
viewY += getResources().getInteger(R.integer.config_dragViewOffsetY);
// Set its old pos (in the new parent's coordinates); it will be animated
// in animateViewIntoPosition after the next layout pass
@@ -2176,6 +2175,11 @@ public class Workspace extends SmoothPagedView
mDragInfo = null;
}
@Override
public void onDragViewVisible() {
((View) mDragInfo.cell).setVisibility(View.GONE);
}
public boolean isDropEnabled() {
return true;
}