Fixing issue where the outline is on the wrong side of the screen when dragging to final page.
- Also allowing pages to snap in springloaded mode without moving your finger. Change-Id: I868f700bd740f2cd1e02023e1dee0f66b0799c58
This commit is contained in:
@@ -525,6 +525,12 @@ public class DragController {
|
||||
}
|
||||
}
|
||||
|
||||
public void forceMoveEvent() {
|
||||
if (mDragging) {
|
||||
handleMoveEvent(mDragObject.x, mDragObject.y);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Call this from a drag source view.
|
||||
*/
|
||||
@@ -558,12 +564,14 @@ public class DragController {
|
||||
// Ensure that we've processed a move event at the current pointer location.
|
||||
handleMoveEvent(dragLayerX, dragLayerY);
|
||||
|
||||
mHandler.removeCallbacks(mScrollRunnable);
|
||||
if (mDragging) {
|
||||
drop(dragLayerX, dragLayerY);
|
||||
}
|
||||
endDrag();
|
||||
break;
|
||||
case MotionEvent.ACTION_CANCEL:
|
||||
mHandler.removeCallbacks(mScrollRunnable);
|
||||
cancelDrag();
|
||||
break;
|
||||
}
|
||||
@@ -690,7 +698,7 @@ public class DragController {
|
||||
|
||||
if (isDragging()) {
|
||||
// Force an update so that we can requeue the scroller if necessary
|
||||
handleMoveEvent(mDragObject.x, mDragObject.y);
|
||||
forceMoveEvent();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ package com.android.launcher2;
|
||||
|
||||
public class SpringLoadedDragController implements OnAlarmListener {
|
||||
// how long the user must hover over a mini-screen before it unshrinks
|
||||
final long ENTER_SPRING_LOAD_HOVER_TIME = 550;
|
||||
final long ENTER_SPRING_LOAD_HOVER_TIME = 500;
|
||||
final long ENTER_SPRING_LOAD_CANCEL_HOVER_TIME = 950;
|
||||
final long EXIT_SPRING_LOAD_HOVER_TIME = 200;
|
||||
|
||||
|
||||
@@ -705,9 +705,15 @@ public class Workspace extends SmoothPagedView
|
||||
clearChildrenCache();
|
||||
}
|
||||
|
||||
// Hide the outlines, as long as we're not dragging
|
||||
if (!mDragController.dragging()) {
|
||||
// Only hide page outlines as we pan if we are on large screen
|
||||
|
||||
if (mDragController.isDragging()) {
|
||||
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();
|
||||
}
|
||||
} else {
|
||||
// If we are not mid-dragging, hide the page outlines if we are on a large screen
|
||||
if (LauncherApplication.isScreenLarge()) {
|
||||
hideOutlines();
|
||||
}
|
||||
@@ -2485,7 +2491,11 @@ public class Workspace extends SmoothPagedView
|
||||
v.getMatrix().invert(mTempInverseMatrix);
|
||||
cachedInverseMatrix = mTempInverseMatrix;
|
||||
}
|
||||
xy[0] = xy[0] + mScrollX - v.getLeft();
|
||||
int scrollX = mScrollX;
|
||||
if (mNextPage != INVALID_PAGE) {
|
||||
scrollX = mScroller.getFinalX();
|
||||
}
|
||||
xy[0] = xy[0] + scrollX - v.getLeft();
|
||||
xy[1] = xy[1] + mScrollY - v.getTop();
|
||||
cachedInverseMatrix.mapPoints(xy);
|
||||
}
|
||||
@@ -2507,7 +2517,11 @@ public class Workspace extends SmoothPagedView
|
||||
*/
|
||||
void mapPointFromChildToSelf(View v, float[] xy) {
|
||||
v.getMatrix().mapPoints(xy);
|
||||
xy[0] -= (mScrollX - v.getLeft());
|
||||
int scrollX = mScrollX;
|
||||
if (mNextPage != INVALID_PAGE) {
|
||||
scrollX = mScroller.getFinalX();
|
||||
}
|
||||
xy[0] -= (scrollX - v.getLeft());
|
||||
xy[1] -= (mScrollY - v.getTop());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user