summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAdam Cohen <adamcohen@google.com>2013-09-29 14:48:04 -0700
committerAdam Cohen <adamcohen@google.com>2013-09-29 15:50:01 -0700
commit74c5491d1b84e072d29065748b41f0bb67459f59 (patch)
tree10d6b3f6c106e3367bae3e26af90e08473009a2a /src
parent949debe6e64034be1625ec21de100ea7e68545e2 (diff)
downloadandroid_packages_apps_Trebuchet-74c5491d1b84e072d29065748b41f0bb67459f59.tar.gz
android_packages_apps_Trebuchet-74c5491d1b84e072d29065748b41f0bb67459f59.tar.bz2
android_packages_apps_Trebuchet-74c5491d1b84e072d29065748b41f0bb67459f59.zip
Improving the granularity of reorder with resize on drop (issue 9533227)
Change-Id: If196f75c148487a8d31f4fcdb5293cc41d3bb7a7
Diffstat (limited to 'src')
-rw-r--r--src/com/android/launcher3/Workspace.java25
1 files changed, 14 insertions, 11 deletions
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java
index 9e43dd81b..7f6964f0f 100644
--- a/src/com/android/launcher3/Workspace.java
+++ b/src/com/android/launcher3/Workspace.java
@@ -3125,9 +3125,18 @@ public class Workspace extends SmoothPagedView
ItemInfo info = (ItemInfo) d.dragInfo;
+ int minSpanX = item.spanX;
+ int minSpanY = item.spanY;
+ if (item.minSpanX > 0 && item.minSpanY > 0) {
+ minSpanX = item.minSpanX;
+ minSpanY = item.minSpanY;
+ }
+
mTargetCell = findNearestArea((int) mDragViewVisualCenter[0],
- (int) mDragViewVisualCenter[1], item.spanX, item.spanY,
+ (int) mDragViewVisualCenter[1], minSpanX, minSpanY,
mDragTargetLayout, mTargetCell);
+ int reorderX = mTargetCell[0];
+ int reorderY = mTargetCell[1];
setCurrentDropOverCell(mTargetCell[0], mTargetCell[1]);
@@ -3140,13 +3149,6 @@ public class Workspace extends SmoothPagedView
manageFolderFeedback(info, mDragTargetLayout, mTargetCell,
targetCellDistance, dragOverView);
- int minSpanX = item.spanX;
- int minSpanY = item.spanY;
- if (item.minSpanX > 0 && item.minSpanY > 0) {
- minSpanX = item.minSpanX;
- minSpanY = item.minSpanY;
- }
-
boolean nearestDropOccupied = mDragTargetLayout.isNearestDropLocationOccupied((int)
mDragViewVisualCenter[0], (int) mDragViewVisualCenter[1], item.spanX,
item.spanY, child, mTargetCell);
@@ -3157,8 +3159,8 @@ public class Workspace extends SmoothPagedView
mTargetCell[0], mTargetCell[1], item.spanX, item.spanY, false,
d.dragView.getDragVisualizeOffset(), d.dragView.getDragRegion());
} else if ((mDragMode == DRAG_MODE_NONE || mDragMode == DRAG_MODE_REORDER)
- && !mReorderAlarm.alarmPending() && (mLastReorderX != mTargetCell[0] ||
- mLastReorderY != mTargetCell[1])) {
+ && !mReorderAlarm.alarmPending() && (mLastReorderX != reorderX ||
+ mLastReorderY != reorderY)) {
// Otherwise, if we aren't adding to or creating a folder and there's no pending
// reorder, then we schedule a reorder
@@ -3257,7 +3259,8 @@ public class Workspace extends SmoothPagedView
public void onAlarm(Alarm alarm) {
int[] resultSpan = new int[2];
mTargetCell = findNearestArea((int) mDragViewVisualCenter[0],
- (int) mDragViewVisualCenter[1], spanX, spanY, mDragTargetLayout, mTargetCell);
+ (int) mDragViewVisualCenter[1], minSpanX, minSpanY, mDragTargetLayout,
+ mTargetCell);
mLastReorderX = mTargetCell[0];
mLastReorderY = mTargetCell[1];