From aa6f66aad29171bda85e0633c93530beefdac307 Mon Sep 17 00:00:00 2001 From: Jon Miranda Date: Tue, 9 May 2017 12:43:44 -0700 Subject: Fix bug where deep shortcut drag view target was skewed to the right. Bug: 38140665 Change-Id: I9386bf70cf51b6be33264f85cbfe9e8049d0c32e --- src/com/android/launcher3/Workspace.java | 3 +++ src/com/android/launcher3/shortcuts/ShortcutsItemView.java | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'src/com/android') diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java index 48a62d981..369d80d77 100644 --- a/src/com/android/launcher3/Workspace.java +++ b/src/com/android/launcher3/Workspace.java @@ -75,6 +75,7 @@ import com.android.launcher3.folder.FolderIcon; import com.android.launcher3.graphics.DragPreviewProvider; import com.android.launcher3.graphics.PreloadIconDrawable; import com.android.launcher3.popup.PopupContainerWithArrow; +import com.android.launcher3.shortcuts.ShortcutDragPreviewProvider; import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType; import com.android.launcher3.userevent.nano.LauncherLogProto.Target; import com.android.launcher3.util.ItemInfoMatcher; @@ -2257,6 +2258,8 @@ public class Workspace extends PagedView int previewSize = grid.folderIconSizePx; dragVisualizeOffset = new Point(- halfPadding, halfPadding - child.getPaddingTop()); dragRect = new Rect(0, child.getPaddingTop(), child.getWidth(), previewSize); + } else if (previewProvider instanceof ShortcutDragPreviewProvider) { + dragVisualizeOffset = new Point(- halfPadding, halfPadding); } // Clear the pressed state if necessary diff --git a/src/com/android/launcher3/shortcuts/ShortcutsItemView.java b/src/com/android/launcher3/shortcuts/ShortcutsItemView.java index ee64b984a..a5c3120a5 100644 --- a/src/com/android/launcher3/shortcuts/ShortcutsItemView.java +++ b/src/com/android/launcher3/shortcuts/ShortcutsItemView.java @@ -109,7 +109,7 @@ public class ShortcutsItemView extends PopupItemView implements View.OnLongClick mIconShift.x = mIconLastTouchPos.x - sv.getIconCenter().x; mIconShift.y = mIconLastTouchPos.y - mLauncher.getDeviceProfile().iconSizePx; - DragView dv = mLauncher.getWorkspace().beginDragShared(sv.getBubbleText(), + DragView dv = mLauncher.getWorkspace().beginDragShared(sv.getIconView(), (PopupContainerWithArrow) getParent(), sv.getFinalInfo(), new ShortcutDragPreviewProvider(sv.getIconView(), mIconShift), new DragOptions()); dv.animateShift(-mIconShift.x, -mIconShift.y); -- cgit v1.2.3