Merge "Fixing issue where dragging in the hotseat could trigger scrolling to side pages. (Bug: 5151006)"

This commit is contained in:
Winson Chung authored and Android (Google) Code Review committed 2011-10-03 16:12:08 -07:00
commit 700eef7bc6
3 files changed
+19 -11

No files matched your search

@@ -484,16 +484,18 @@ public class DragController {
if (!inDeleteRegion && x < mScrollZone) { if (!inDeleteRegion && x < mScrollZone) {
if (mScrollState == SCROLL_OUTSIDE_ZONE && mDistanceSinceScroll > slop) { if (mScrollState == SCROLL_OUTSIDE_ZONE && mDistanceSinceScroll > slop) {
mScrollState = SCROLL_WAITING_IN_ZONE; mScrollState = SCROLL_WAITING_IN_ZONE;
mScrollRunnable.setDirection(SCROLL_LEFT); if (mDragScroller.onEnterScrollArea(x, y, SCROLL_LEFT)) {
mHandler.postDelayed(mScrollRunnable, SCROLL_DELAY); mScrollRunnable.setDirection(SCROLL_LEFT);
mDragScroller.onEnterScrollArea(x, y, SCROLL_LEFT); mHandler.postDelayed(mScrollRunnable, SCROLL_DELAY);
}
} }
} else if (!inDeleteRegion && x > mScrollView.getWidth() - mScrollZone) { } else if (!inDeleteRegion && x > mScrollView.getWidth() - mScrollZone) {
if (mScrollState == SCROLL_OUTSIDE_ZONE && mDistanceSinceScroll > slop) { if (mScrollState == SCROLL_OUTSIDE_ZONE && mDistanceSinceScroll > slop) {
mScrollState = SCROLL_WAITING_IN_ZONE; mScrollState = SCROLL_WAITING_IN_ZONE;
mScrollRunnable.setDirection(SCROLL_RIGHT); if (mDragScroller.onEnterScrollArea(x, y, SCROLL_RIGHT)) {
mHandler.postDelayed(mScrollRunnable, SCROLL_DELAY); mScrollRunnable.setDirection(SCROLL_RIGHT);
mDragScroller.onEnterScrollArea(x, y, SCROLL_RIGHT); mHandler.postDelayed(mScrollRunnable, SCROLL_DELAY);
}
} }
} else { } else {
if (mScrollState == SCROLL_WAITING_IN_ZONE) { if (mScrollState == SCROLL_WAITING_IN_ZONE) {
+2 -2
View File
@@ -30,11 +30,11 @@ public interface DragScroller {
* *
* @param direction The scroll direction * @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. * The touch point has left the scroll area.
* NOTE: This may not be called, if a drop occurs inside the scroll area. * NOTE: This may not be called, if a drop occurs inside the scroll area.
*/ */
void onExitScrollArea(); boolean onExitScrollArea();
} }
+9 -3
View File
@@ -3097,16 +3097,17 @@ public class Workspace extends SmoothPagedView
} }
@Override @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 // Ignore the scroll area if we are dragging over the hot seat
if (mLauncher.getHotseat() != null) { if (mLauncher.getHotseat() != null) {
Rect r = new Rect(); Rect r = new Rect();
mLauncher.getHotseat().getHitRect(r); mLauncher.getHotseat().getHitRect(r);
if (r.contains(x, y)) { if (r.contains(x, y)) {
return; return false;
} }
} }
boolean result = false;
if (!isSmall() && !mIsSwitchingState) { if (!isSmall() && !mIsSwitchingState) {
mInScrollArea = true; mInScrollArea = true;
@@ -3126,12 +3127,15 @@ public class Workspace extends SmoothPagedView
// Workspace is responsible for drawing the edge glow on adjacent pages, // Workspace is responsible for drawing the edge glow on adjacent pages,
// so we need to redraw the workspace when this may have changed. // so we need to redraw the workspace when this may have changed.
invalidate(); invalidate();
result = true;
} }
} }
return result;
} }
@Override @Override
public void onExitScrollArea() { public boolean onExitScrollArea() {
boolean result = false;
if (mInScrollArea) { if (mInScrollArea) {
if (mDragTargetLayout != null) { if (mDragTargetLayout != null) {
// Unmark the overlapping layout and re-enter the current layout // 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, // Workspace is responsible for drawing the edge glow on adjacent pages,
// so we need to redraw the workspace when this may have changed. // so we need to redraw the workspace when this may have changed.
invalidate(); invalidate();
result = true;
} }
mInScrollArea = false; mInScrollArea = false;
} }
return result;
} }
private void onResetScrollArea() { private void onResetScrollArea() {