Merge "Ensure that the reorder preview and what gets submited uses the same solution." into tm-qpr-dev
This commit is contained in:
commit
c3cefebab4
2 files changed
+18
-21
No files matched your search
@@ -2544,21 +2544,21 @@ public class CellLayout extends ViewGroup {
|
|||||||
if (result == null) {
|
if (result == null) {
|
||||||
result = new int[]{-1, -1};
|
result = new int[]{-1, -1};
|
||||||
}
|
}
|
||||||
ItemConfiguration finalSolution;
|
|
||||||
// When we are checking drop validity or actually dropping, we don't recompute the
|
ItemConfiguration finalSolution = null;
|
||||||
// direction vector, since we want the solution to match the preview, and it's possible
|
// We want the solution to match the animation of the preview and to match the drop so we
|
||||||
// that the exact position of the item has changed to result in a new reordering outcome.
|
// only recalculate in mode MODE_SHOW_REORDER_HINT because that the first one to run in the
|
||||||
if ((mode == MODE_ON_DROP || mode == MODE_ON_DROP_EXTERNAL || mode == MODE_ACCEPT_DROP)
|
// reorder cycle.
|
||||||
&& mPreviousSolution != null) {
|
if (mode == MODE_SHOW_REORDER_HINT || mPreviousSolution == null) {
|
||||||
|
finalSolution = calculateReorder(pixelX, pixelY, minSpanX, minSpanY, spanX, spanY,
|
||||||
|
dragView);
|
||||||
|
mPreviousSolution = finalSolution;
|
||||||
|
} else {
|
||||||
finalSolution = mPreviousSolution;
|
finalSolution = mPreviousSolution;
|
||||||
// We reset this vector after drop
|
// We reset this vector after drop
|
||||||
if (mode == MODE_ON_DROP || mode == MODE_ON_DROP_EXTERNAL) {
|
if (mode == MODE_ON_DROP || mode == MODE_ON_DROP_EXTERNAL) {
|
||||||
mPreviousSolution = null;
|
mPreviousSolution = null;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
finalSolution = calculateReorder(pixelX, pixelY, minSpanX, minSpanY, spanX, spanY,
|
|
||||||
dragView);
|
|
||||||
mPreviousSolution = finalSolution;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (finalSolution == null || !finalSolution.isSolution) {
|
if (finalSolution == null || !finalSolution.isSolution) {
|
||||||
|
|||||||
@@ -2384,23 +2384,20 @@ public class Workspace<T extends View & PageIndicator> extends PagedView<T>
|
|||||||
final View child = (mDragInfo == null) ? null : mDragInfo.cell;
|
final View child = (mDragInfo == null) ? null : mDragInfo.cell;
|
||||||
int reorderX = mTargetCell[0];
|
int reorderX = mTargetCell[0];
|
||||||
int reorderY = mTargetCell[1];
|
int reorderY = mTargetCell[1];
|
||||||
if (!nearestDropOccupied) {
|
if ((mDragMode == DRAG_MODE_NONE || mDragMode == DRAG_MODE_REORDER)
|
||||||
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)
|
|
||||||
&& !mReorderAlarm.alarmPending()
|
|
||||||
&& (mLastReorderX != reorderX || mLastReorderY != reorderY)
|
&& (mLastReorderX != reorderX || mLastReorderY != reorderY)
|
||||||
&& targetCellDistance < mDragTargetLayout.getReorderRadius(mTargetCell, item.spanX,
|
&& targetCellDistance < mDragTargetLayout.getReorderRadius(mTargetCell, item.spanX,
|
||||||
item.spanY)) {
|
item.spanY)) {
|
||||||
|
|
||||||
int[] resultSpan = new int[2];
|
|
||||||
mDragTargetLayout.performReorder((int) mDragViewVisualCenter[0],
|
mDragTargetLayout.performReorder((int) mDragViewVisualCenter[0],
|
||||||
(int) mDragViewVisualCenter[1], minSpanX, minSpanY, item.spanX, item.spanY,
|
(int) mDragViewVisualCenter[1], minSpanX, minSpanY, item.spanX, item.spanY,
|
||||||
child, mTargetCell, resultSpan, CellLayout.MODE_SHOW_REORDER_HINT);
|
child, mTargetCell, new int[2], CellLayout.MODE_SHOW_REORDER_HINT);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!nearestDropOccupied) {
|
||||||
|
mDragTargetLayout.visualizeDropLocation(mTargetCell[0], mTargetCell[1],
|
||||||
|
item.spanX, item.spanY, d);
|
||||||
|
} else if ((mDragMode == DRAG_MODE_NONE || mDragMode == DRAG_MODE_REORDER)
|
||||||
|
&& !mReorderAlarm.alarmPending()) {
|
||||||
// Otherwise, if we aren't adding to or creating a folder and there's no pending
|
// Otherwise, if we aren't adding to or creating a folder and there's no pending
|
||||||
// reorder, then we schedule a reorder
|
// reorder, then we schedule a reorder
|
||||||
ReorderAlarmListener listener = new ReorderAlarmListener(mDragViewVisualCenter,
|
ReorderAlarmListener listener = new ReorderAlarmListener(mDragViewVisualCenter,
|
||||||
|
|||||||
Reference in new issue
Block a user