Substantially improved performance of dragging and drop animations

-> Took DragView drawing out of the window and put it into the DragLayer
-> Added fade-in/out animations to transition between the final view
   and the DragView, after the view animates
-> Enabled hardware layers on Folder items which improves the
   performance Folder reordering

Change-Id: I4d92ca9fba172d1bab9efc215a99abcaadcdf503
This commit is contained in:
Adam Cohen
2011-07-07 16:38:18 -07:00
parent eb99f1648c
commit 8dfcba4af7
10 changed files with 183 additions and 189 deletions
+10 -9
View File
@@ -205,8 +205,6 @@ public class Workspace extends SmoothPagedView
private FolderRingAnimator mDragFolderRingAnimator = null;
private View mLastDragOverView = null;
private boolean mCreateUserFolderOnDrop = false;
private int mCellWidth = -1;
private int mCellHeight = -1;
// Variables relating to touch disambiguation (scrolling workspace vs. scrolling a widget)
private float mXDown;
@@ -1284,7 +1282,6 @@ public class Workspace extends SmoothPagedView
shrink(shrinkState, true);
}
// we use this to shrink the workspace for the all apps view and the customize view
public void shrink(ShrinkState shrinkState, boolean animated) {
if (mFirstLayout) {
@@ -2003,9 +2000,9 @@ public class Workspace extends SmoothPagedView
final int bmpWidth = b.getWidth();
final int bmpHeight = b.getHeight();
child.getLocationOnScreen(mTempXY);
final int screenX = (int) mTempXY[0] + (child.getWidth() - bmpWidth) / 2;
final int screenY = (int) mTempXY[1] + (child.getHeight() - bmpHeight) / 2;
mLauncher.getDragLayer().getLocationInDragLayer(child, mTempXY);
final int dragLayerX = (int) mTempXY[0] + (child.getWidth() - bmpWidth) / 2;
final int dragLayerY = (int) mTempXY[1] + (child.getHeight() - bmpHeight) / 2;
Rect dragRect = null;
if (child instanceof BubbleTextView) {
@@ -2021,7 +2018,7 @@ public class Workspace extends SmoothPagedView
}
mLauncher.lockScreenOrientation();
mDragController.startDrag(b, screenX, screenY, this, child.getTag(),
mDragController.startDrag(b, dragLayerX, dragLayerY, this, child.getTag(),
DragController.DRAG_ACTION_MOVE, dragRect);
b.recycle();
}
@@ -2288,11 +2285,11 @@ public class Workspace extends SmoothPagedView
}
public void getViewLocationRelativeToSelf(View v, int[] location) {
getLocationOnScreen(location);
getLocationInWindow(location);
int x = location[0];
int y = location[1];
v.getLocationOnScreen(location);
v.getLocationInWindow(location);
int vX = location[0];
int vY = location[1];
@@ -3288,4 +3285,8 @@ public class Workspace extends SmoothPagedView
return String.format(mContext.getString(R.string.workspace_scroll_format),
page + 1, getChildCount());
}
public void getLocationInDragLayer(int[] loc) {
mLauncher.getDragLayer().getLocationInDragLayer(this, loc);
}
}