diff options
author | Winson Chung <winsonc@google.com> | 2011-10-03 16:12:08 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-10-03 16:12:08 -0700 |
commit | 700eef7bc66687ba626e507d93dcb93f829a5fba (patch) | |
tree | 69dac2cda9c469e31ab79a8c95b09bd6b214a8b9 | |
parent | a25f0553733c4c89304bcda1a42489228ccdf1d9 (diff) | |
parent | 3e0839e5f830ab7e64223ebe186d97729eda3e22 (diff) | |
download | android_packages_apps_Trebuchet-700eef7bc66687ba626e507d93dcb93f829a5fba.tar.gz android_packages_apps_Trebuchet-700eef7bc66687ba626e507d93dcb93f829a5fba.tar.bz2 android_packages_apps_Trebuchet-700eef7bc66687ba626e507d93dcb93f829a5fba.zip |
Merge "Fixing issue where dragging in the hotseat could trigger scrolling to side pages. (Bug: 5151006)"
-rw-r--r-- | src/com/android/launcher2/DragController.java | 14 | ||||
-rw-r--r-- | src/com/android/launcher2/DragScroller.java | 4 | ||||
-rw-r--r-- | src/com/android/launcher2/Workspace.java | 12 |
3 files changed, 19 insertions, 11 deletions
diff --git a/src/com/android/launcher2/DragController.java b/src/com/android/launcher2/DragController.java index ca7e55b64..107f8ef9d 100644 --- a/src/com/android/launcher2/DragController.java +++ b/src/com/android/launcher2/DragController.java @@ -484,16 +484,18 @@ public class DragController { if (!inDeleteRegion && x < mScrollZone) { if (mScrollState == SCROLL_OUTSIDE_ZONE && mDistanceSinceScroll > slop) { mScrollState = SCROLL_WAITING_IN_ZONE; - mScrollRunnable.setDirection(SCROLL_LEFT); - mHandler.postDelayed(mScrollRunnable, SCROLL_DELAY); - mDragScroller.onEnterScrollArea(x, y, SCROLL_LEFT); + if (mDragScroller.onEnterScrollArea(x, y, SCROLL_LEFT)) { + mScrollRunnable.setDirection(SCROLL_LEFT); + mHandler.postDelayed(mScrollRunnable, SCROLL_DELAY); + } } } else if (!inDeleteRegion && x > mScrollView.getWidth() - mScrollZone) { if (mScrollState == SCROLL_OUTSIDE_ZONE && mDistanceSinceScroll > slop) { mScrollState = SCROLL_WAITING_IN_ZONE; - mScrollRunnable.setDirection(SCROLL_RIGHT); - mHandler.postDelayed(mScrollRunnable, SCROLL_DELAY); - mDragScroller.onEnterScrollArea(x, y, SCROLL_RIGHT); + if (mDragScroller.onEnterScrollArea(x, y, SCROLL_RIGHT)) { + mScrollRunnable.setDirection(SCROLL_RIGHT); + mHandler.postDelayed(mScrollRunnable, SCROLL_DELAY); + } } } else { if (mScrollState == SCROLL_WAITING_IN_ZONE) { diff --git a/src/com/android/launcher2/DragScroller.java b/src/com/android/launcher2/DragScroller.java index 894b06b27..a3ee6c237 100644 --- a/src/com/android/launcher2/DragScroller.java +++ b/src/com/android/launcher2/DragScroller.java @@ -30,11 +30,11 @@ public interface DragScroller { * * @param direction The scroll direction */ - void onEnterScrollArea(int x, int y, int direction); + boolean onEnterScrollArea(int x, int y, int direction); /** * The touch point has left the scroll area. * NOTE: This may not be called, if a drop occurs inside the scroll area. */ - void onExitScrollArea(); + boolean onExitScrollArea(); } diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java index 70289d4a0..9c25afc64 100644 --- a/src/com/android/launcher2/Workspace.java +++ b/src/com/android/launcher2/Workspace.java @@ -3097,16 +3097,17 @@ public class Workspace extends SmoothPagedView } @Override - public void onEnterScrollArea(int x, int y, int direction) { + public boolean onEnterScrollArea(int x, int y, int direction) { // Ignore the scroll area if we are dragging over the hot seat if (mLauncher.getHotseat() != null) { Rect r = new Rect(); mLauncher.getHotseat().getHitRect(r); if (r.contains(x, y)) { - return; + return false; } } + boolean result = false; if (!isSmall() && !mIsSwitchingState) { mInScrollArea = true; @@ -3126,12 +3127,15 @@ public class Workspace extends SmoothPagedView // Workspace is responsible for drawing the edge glow on adjacent pages, // so we need to redraw the workspace when this may have changed. invalidate(); + result = true; } } + return result; } @Override - public void onExitScrollArea() { + public boolean onExitScrollArea() { + boolean result = false; if (mInScrollArea) { if (mDragTargetLayout != null) { // Unmark the overlapping layout and re-enter the current layout @@ -3142,9 +3146,11 @@ public class Workspace extends SmoothPagedView // Workspace is responsible for drawing the edge glow on adjacent pages, // so we need to redraw the workspace when this may have changed. invalidate(); + result = true; } mInScrollArea = false; } + return result; } private void onResetScrollArea() { |