Merge "Fixing issue where dragging in the hotseat could trigger scrolling to side pages. (Bug: 5151006)"
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user