Separate animations and add dragOffSet points in dragOptions

For 1, when animateShift() is called shiftAnimation() is the only thing needed.
2, by having point saved in preDragCondition, we can use that to update the drag layers and not have to
modify registrationX/Y later

Removed dragVisualizedOffset since it does not do anything.

There is an issue that also needs to be fixed if user decides to long click
on a search result and let go, the icon flashes at the touch point when you let go.. so we check when mContent can be shown in DragView
depending on if there is dragOffset.
If there is dragOffset, set mContent to invisible.
If there is no dragOffset, set mContent to visible because it doesn't matter as the original content is at the same spot.

bug: 245659929
test: manual: video: https://drive.google.com/file/d/1JQ0pud31HU0WlrqecX0v1cdPKQ37jQCf/view?usp=sharing
Change-Id: I4d2276b9c43e1e92c45d8538b8dde70baa84a5e8
This commit is contained in:
Brandon Dayauon
2023-04-21 11:09:33 -07:00
parent fda9f3d430
commit e63401e711
10 changed files with 81 additions and 62 deletions

View File

@@ -1661,17 +1661,14 @@ public class Workspace<T extends View & PageIndicator> extends PagedView<T>
scale = previewProvider.getScaleAndPosition(contentView, mTempXY);
}
int halfPadding = previewProvider.previewPadding / 2;
int dragLayerX = mTempXY[0];
int dragLayerY = mTempXY[1];
Point dragVisualizeOffset = null;
Rect dragRect = new Rect();
if (draggableView != null) {
draggableView.getSourceVisualDragBounds(dragRect);
dragLayerY += dragRect.top;
dragVisualizeOffset = new Point(-halfPadding, halfPadding);
}
@@ -1689,6 +1686,15 @@ public class Workspace<T extends View & PageIndicator> extends PagedView<T>
}
}
if (dragOptions.preDragCondition != null) {
int xDragOffSet = dragOptions.preDragCondition.getDragOffset().x;
int yDragOffSet = dragOptions.preDragCondition.getDragOffset().y;
if (xDragOffSet != 0 || yDragOffSet != 0) {
dragLayerX += xDragOffSet;
dragLayerY += yDragOffSet;
}
}
final DragView dv;
if (contentView instanceof View) {
if (contentView instanceof LauncherAppWidgetHostView) {
@@ -1701,7 +1707,6 @@ public class Workspace<T extends View & PageIndicator> extends PagedView<T>
dragLayerY,
source,
dragObject,
dragVisualizeOffset,
dragRect,
scale * iconScale,
scale,
@@ -1714,7 +1719,6 @@ public class Workspace<T extends View & PageIndicator> extends PagedView<T>
dragLayerY,
source,
dragObject,
dragVisualizeOffset,
dragRect,
scale * iconScale,
scale,