protected Rect getIconRect(int itemWidth, int itemHeight, int drawableWidth, int drawableHeight) { DragLayer dragLayer = mLauncher.getDragLayer(); // Find the rect to animate to (the view is center aligned) Rect to = new Rect(); dragLayer.getViewRectRelativeToSelf(this, to); int width = drawableWidth; int height = drawableHeight; int left = to.left + getPaddingLeft(); int top = to.top + (getMeasuredHeight() - height) / 2; to.set(left, top, left + width, top + height); // Center the destination rect about the trash icon int xOffset = (int) -(itemWidth - width) / 2; int yOffset = (int) -(itemHeight - height) / 2; to.offset(xOffset, yOffset); return to; }
public void getLocationInDragLayer(int[] loc) { mLauncher.getDragLayer().getLocationInDragLayer(this, loc); }