summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorWinson Chung <winsonc@google.com>2013-04-04 18:10:02 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2013-04-04 18:10:02 +0000
commitc9d55c0dd03d4e6ecf56f860e78140b779fa54c8 (patch)
treea29caa6846305a08775035878f2a273a27a3a637 /src
parentdf96add095c82f9083f75305d8fa155c8192a4e6 (diff)
parent25460a1d5cb473033408c9e76898bb77e785c66f (diff)
downloadandroid_packages_apps_Trebuchet-c9d55c0dd03d4e6ecf56f860e78140b779fa54c8.tar.gz
android_packages_apps_Trebuchet-c9d55c0dd03d4e6ecf56f860e78140b779fa54c8.tar.bz2
android_packages_apps_Trebuchet-c9d55c0dd03d4e6ecf56f860e78140b779fa54c8.zip
Merge "Fixing issue where drag view is jumping when you scroll from hovering over an edge. (Bug 8522679)" into jb-mr2-dev
Diffstat (limited to 'src')
-rw-r--r--src/com/android/launcher2/DragController.java35
-rw-r--r--src/com/android/launcher2/Workspace.java2
2 files changed, 22 insertions, 15 deletions
diff --git a/src/com/android/launcher2/DragController.java b/src/com/android/launcher2/DragController.java
index 2eace4166..78afe5704 100644
--- a/src/com/android/launcher2/DragController.java
+++ b/src/com/android/launcher2/DragController.java
@@ -488,6 +488,23 @@ public class DragController {
DropTarget dropTarget = findDropTarget(x, y, coordinates);
mDragObject.x = coordinates[0];
mDragObject.y = coordinates[1];
+ checkTouchMove(dropTarget);
+
+ // Check if we are hovering over the scroll areas
+ mDistanceSinceScroll +=
+ Math.sqrt(Math.pow(mLastTouch[0] - x, 2) + Math.pow(mLastTouch[1] - y, 2));
+ mLastTouch[0] = x;
+ mLastTouch[1] = y;
+ checkScrollState(x, y);
+ }
+
+ public void forceTouchMove() {
+ int[] dummyCoordinates = mCoordinatesTemp;
+ DropTarget dropTarget = findDropTarget(mLastTouch[0], mLastTouch[1], dummyCoordinates);
+ checkTouchMove(dropTarget);
+ }
+
+ private void checkTouchMove(DropTarget dropTarget) {
if (dropTarget != null) {
DropTarget delegate = dropTarget.getDropTargetDelegate(mDragObject);
if (delegate != null) {
@@ -507,14 +524,10 @@ public class DragController {
}
}
mLastDropTarget = dropTarget;
+ }
- // After a scroll, the touch point will still be in the scroll region.
- // Rather than scrolling immediately, require a bit of twiddling to scroll again
+ private void checkScrollState(int x, int y) {
final int slop = ViewConfiguration.get(mLauncher).getScaledWindowTouchSlop();
- mDistanceSinceScroll +=
- Math.sqrt(Math.pow(mLastTouch[0] - x, 2) + Math.pow(mLastTouch[1] - y, 2));
- mLastTouch[0] = x;
- mLastTouch[1] = y;
final int delay = mDistanceSinceScroll < slop ? RESCROLL_DELAY : SCROLL_DELAY;
final DragLayer dragLayer = mLauncher.getDragLayer();
final boolean isRtl = (dragLayer.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL);
@@ -544,12 +557,6 @@ public class DragController {
}
}
- public void forceMoveEvent() {
- if (mDragging) {
- handleMoveEvent(mDragObject.x, mDragObject.y);
- }
- }
-
/**
* Call this from a drag source view.
*/
@@ -800,8 +807,8 @@ public class DragController {
mLauncher.getDragLayer().onExitScrollArea();
if (isDragging()) {
- // Force an update so that we can requeue the scroller if necessary
- forceMoveEvent();
+ // Check the scroll again so that we can requeue the scroller if necessary
+ checkScrollState(mLastTouch[0], mLastTouch[1]);
}
}
}
diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java
index 7d7ca8614..d4488db2e 100644
--- a/src/com/android/launcher2/Workspace.java
+++ b/src/com/android/launcher2/Workspace.java
@@ -773,7 +773,7 @@ public class Workspace extends SmoothPagedView
if (isSmall()) {
// If we are in springloaded mode, then force an event to check if the current touch
// is under a new page (to scroll to)
- mDragController.forceMoveEvent();
+ mDragController.forceTouchMove();
}
} else {
// If we are not mid-dragging, hide the page outlines if we are on a large screen