Creating a new alarm when drag X,Y change

If the user is changing the X and Y of the reorder, wich requires
the user to move at least one Workspace cell from the previous
position, then it doesn't make sense to wait for the previous alarm to finish
to start a new reorder.

Also, I added a new test to run on foldable devices.

Fix: 259995663
Fix: 259295374
Test: atest ReorderWidgets (it mostly fails on postsubmit)
Test: modify ReorderWidgets.fullReorder to run 20 times and it should work, before the chagne it would fail.
Change-Id: Ic6b436ea1088f8092c849e9791862947e9035c9f
This commit is contained in:
Sebastian Franco
2022-12-05 16:16:45 -08:00
parent c4d6dee069
commit 5356ff955c
3 changed files with 27 additions and 11 deletions

View File

@@ -2392,10 +2392,10 @@ public class Workspace<T extends View & PageIndicator> extends PagedView<T>
mDragTargetLayout.visualizeDropLocation(mTargetCell[0], mTargetCell[1],
item.spanX, item.spanY, d);
} else if ((mDragMode == DRAG_MODE_NONE || mDragMode == DRAG_MODE_REORDER)
&& !mReorderAlarm.alarmPending()
&& (mLastReorderX != reorderX || mLastReorderY != reorderY)
&& targetCellDistance < mDragTargetLayout.getReorderRadius(mTargetCell, item.spanX,
item.spanY)) {
mReorderAlarm.cancelAlarm();
mLastReorderX = reorderX;
mLastReorderY = reorderY;
mDragTargetLayout.performReorder((int) mDragViewVisualCenter[0],