Merge "Fix swipe-to-dismiss to properly react to swipe gestures." into cw-f-dev
This commit is contained in:
@@ -330,18 +330,16 @@ public class SwipeDismissLayout extends FrameLayout {
|
|||||||
mVelocityTracker.addMovement(ev);
|
mVelocityTracker.addMovement(ev);
|
||||||
mVelocityTracker.computeCurrentVelocity(1000);
|
mVelocityTracker.computeCurrentVelocity(1000);
|
||||||
if (!mDismissed) {
|
if (!mDismissed) {
|
||||||
|
if ((deltaX > (getWidth() * DISMISS_MIN_DRAG_WIDTH_RATIO) &&
|
||||||
if (deltaX > (getWidth() * DISMISS_MIN_DRAG_WIDTH_RATIO) &&
|
ev.getRawX() >= mLastX)
|
||||||
ev.getRawX() >= mLastX) {
|
|| mVelocityTracker.getXVelocity() >= mMinFlingVelocity) {
|
||||||
mDismissed = true;
|
mDismissed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Check if the user tried to undo this.
|
// Check if the user tried to undo this.
|
||||||
if (mDismissed && mSwiping) {
|
if (mDismissed && mSwiping) {
|
||||||
// Check if the user's finger is actually back
|
// Check if the user's finger is actually flinging back to left
|
||||||
if (deltaX < (getWidth() * DISMISS_MIN_DRAG_WIDTH_RATIO) ||
|
if (mVelocityTracker.getXVelocity() < -mMinFlingVelocity) {
|
||||||
// or user is flinging back left
|
|
||||||
mVelocityTracker.getXVelocity() < -mMinFlingVelocity) {
|
|
||||||
mDismissed = false;
|
mDismissed = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user