diff options
author | Sunny Goyal <sunnygoyal@google.com> | 2016-07-22 10:50:11 -0700 |
---|---|---|
committer | Sunny Goyal <sunnygoyal@google.com> | 2016-07-27 17:37:23 -0700 |
commit | a2454ad2d8dcffa94f670853eb464726c73597f1 (patch) | |
tree | 63899483e75a7faadff477cb117bf5c5cfc54962 /src/com/android/launcher3/Workspace.java | |
parent | 71538da6e2e70af15684cc270a6e67c9b5a010dc (diff) | |
download | android_packages_apps_Trebuchet-a2454ad2d8dcffa94f670853eb464726c73597f1.tar.gz android_packages_apps_Trebuchet-a2454ad2d8dcffa94f670853eb464726c73597f1.tar.bz2 android_packages_apps_Trebuchet-a2454ad2d8dcffa94f670853eb464726c73597f1.zip |
Launcher shortcuts animations update.
> The shortcut container closes with an animation
> When opening/closing the animation only the icon scales
and not the title and drag handle
> When dragging the icon, it starts from the original icon position and
moves under the user finger. The container grows to follow the drag view.
Bug: 28980830
Change-Id: Ic0353c30b682d1f018cbf4d62e8a6e8e7d7d4664
Diffstat (limited to 'src/com/android/launcher3/Workspace.java')
-rw-r--r-- | src/com/android/launcher3/Workspace.java | 33 |
1 files changed, 10 insertions, 23 deletions
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java index 3c057e6fd..341c7c88a 100644 --- a/src/com/android/launcher3/Workspace.java +++ b/src/com/android/launcher3/Workspace.java @@ -2312,12 +2312,13 @@ public class Workspace extends PagedView + "View: " + child + " tag: " + child.getTag(); throw new IllegalStateException(msg); } - beginDragShared(child, new Point(), source, accessible, - (ItemInfo) dragObject, new DragPreviewProvider(child)); + beginDragShared(child, source, accessible, (ItemInfo) dragObject, + new DragPreviewProvider(child)); } - public void beginDragShared(View child, Point relativeTouchPos, DragSource source, - boolean accessible, ItemInfo dragObject, DragPreviewProvider previewProvider) { + + public DragView beginDragShared(View child, DragSource source, boolean accessible, + ItemInfo dragObject, DragPreviewProvider previewProvider) { child.clearFocus(); child.setPressed(false); @@ -2329,34 +2330,19 @@ public class Workspace extends PagedView final Bitmap b = previewProvider.createDragBitmap(mCanvas); int halfPadding = previewProvider.previewPadding / 2; - final int bmpWidth = b.getWidth(); - final int bmpHeight = b.getHeight(); - - float scale = mLauncher.getDragLayer().getLocationInDragLayer(child, mTempXY); - int dragLayerX = Math.round(mTempXY[0] - (bmpWidth - scale * child.getWidth()) / 2); - int dragLayerY = Math.round(mTempXY[1] - (bmpHeight - scale * bmpHeight) / 2 - halfPadding); + float scale = previewProvider.getScaleAndPosition(b, mTempXY); + int dragLayerX = mTempXY[0]; + int dragLayerY = mTempXY[1]; DeviceProfile grid = mLauncher.getDeviceProfile(); Point dragVisualizeOffset = null; Rect dragRect = null; if (child instanceof BubbleTextView) { - BubbleTextView icon = (BubbleTextView) child; int iconSize = grid.iconSizePx; int top = child.getPaddingTop(); - int left = (bmpWidth - iconSize) / 2; + int left = (b.getWidth() - iconSize) / 2; int right = left + iconSize; int bottom = top + iconSize; - if (icon.isLayoutHorizontal()) { - // If the layout is horizontal, then if we are just picking up the icon, then just - // use the child position since the icon is top-left aligned. Otherwise, offset - // the drag layer position horizontally so that the icon is under the current - // touch position. - if (icon.getIcon().getBounds().contains(relativeTouchPos.x, relativeTouchPos.y)) { - dragLayerX = Math.round(mTempXY[0]); - } else { - dragLayerX = Math.round(mTempXY[0] + relativeTouchPos.x - (bmpWidth / 2)); - } - } dragLayerY += top; // Note: The drag region is used to calculate drag layer offsets, but the // dragVisualizeOffset in addition to the dragRect (the size) to position the outline. @@ -2388,6 +2374,7 @@ public class Workspace extends PagedView if (!FeatureFlags.LAUNCHER3_LEGACY_WORKSPACE_DND) { mLauncher.enterSpringLoadedDragMode(); } + return dv; } public boolean transitionStateShouldAllowDrop() { |