Refactor / Cleanup / Simplify a bunch of dnd related rendering / animation
Addresses: => Fix folder icon drop location mapping (was very far off) => Fix BubbleTextView drop animation shifted by a few pixels => Get rid multiple unnecessary calls to setDragMode(none), was breaking some of the reorder flow; still some issues to address here. => Fix folder icon parallax (didn't work when the folder had a dot) Test: manual Change-Id: I5959cf341996f75d30212353ec096ed25bf40ea5
This commit is contained in:
@@ -32,6 +32,7 @@ import com.android.launcher3.LauncherAppState;
|
||||
import com.android.launcher3.PendingAddItemInfo;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.dragndrop.DragOptions;
|
||||
import com.android.launcher3.dragndrop.DraggableView;
|
||||
import com.android.launcher3.dragndrop.LivePreviewWidgetCell;
|
||||
import com.android.launcher3.graphics.DragPreviewProvider;
|
||||
import com.android.launcher3.icons.LauncherIcons;
|
||||
@@ -79,6 +80,8 @@ public class PendingItemDragHelper extends DragPreviewProvider {
|
||||
|
||||
mEstimatedCellSize = launcher.getWorkspace().estimateItemSize(mAddInfo);
|
||||
|
||||
DraggableView draggableView;
|
||||
|
||||
if (mAddInfo instanceof PendingAddWidgetInfo) {
|
||||
PendingAddWidgetInfo createWidgetInfo = (PendingAddWidgetInfo) mAddInfo;
|
||||
|
||||
@@ -110,6 +113,7 @@ public class PendingItemDragHelper extends DragPreviewProvider {
|
||||
|
||||
dragOffset = null;
|
||||
dragRegion = null;
|
||||
draggableView = DraggableView.ofType(DraggableView.DRAGGABLE_WIDGET);
|
||||
} else {
|
||||
PendingAddShortcutInfo createShortcutInfo = (PendingAddShortcutInfo) mAddInfo;
|
||||
Drawable icon = createShortcutInfo.activityInfo.getFullResIcon(app.getIconCache());
|
||||
@@ -136,6 +140,7 @@ public class PendingItemDragHelper extends DragPreviewProvider {
|
||||
dragRegion.top = (mEstimatedCellSize[1]
|
||||
- iconSize - dp.iconTextSizePx - dp.iconDrawablePaddingPx) / 2;
|
||||
dragRegion.bottom = dragRegion.top + iconSize;
|
||||
draggableView = DraggableView.ofType(DraggableView.DRAGGABLE_ICON);
|
||||
}
|
||||
|
||||
// Since we are not going through the workspace for starting the drag, set drag related
|
||||
@@ -148,8 +153,8 @@ public class PendingItemDragHelper extends DragPreviewProvider {
|
||||
+ (int) ((scale * preview.getHeight() - preview.getHeight()) / 2);
|
||||
|
||||
// Start the drag
|
||||
launcher.getDragController().startDrag(preview, dragLayerX, dragLayerY, source, mAddInfo,
|
||||
dragOffset, dragRegion, scale, scale, options);
|
||||
launcher.getDragController().startDrag(preview, draggableView, dragLayerX, dragLayerY,
|
||||
source, mAddInfo, dragOffset, dragRegion, scale, scale, options);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user