Decoupling finding the solution and animation of a reorder in CellLayout

Adding new functions to CellLayout, two of them return a solution
(calculateReorder, getSimpleReorder) and the other one takes a
solution and animates that solution (void performReorder) and it can
either submit the solution or just show it for a preview.

Right now this two things are done under the same function:
int[] performReorder. The need to separate this two functions is
because to add this functionality b/188081026 which needs to find
soluion without animation and animation solutions that can be
calculated in another place.

Bug: 188081026
Test: atest ReorderWidgets
Change-Id: Ib519d4346f58f9b55aff5008cd3ccbcfe8443d2d
This commit is contained in:
Sebastian Franco
2022-10-25 17:28:54 -07:00
parent a57bff8473
commit 53a15a4b1f
2 changed files with 123 additions and 70 deletions

View File

@@ -2439,6 +2439,9 @@ public class Workspace<T extends View & PageIndicator> extends PagedView<T>
int reorderX = mTargetCell[0];
int reorderY = mTargetCell[1];
if (!nearestDropOccupied) {
mDragTargetLayout.performReorder((int) mDragViewVisualCenter[0],
(int) mDragViewVisualCenter[1], minSpanX, minSpanY, item.spanX, item.spanY,
child, mTargetCell, new int[2], CellLayout.MODE_SHOW_REORDER_HINT);
mDragTargetLayout.visualizeDropLocation(mTargetCell[0], mTargetCell[1],
item.spanX, item.spanY, d);
} else if ((mDragMode == DRAG_MODE_NONE || mDragMode == DRAG_MODE_REORDER)