Fixes velocity tracking bug in SwipeDismissLayout.

This is the framework version of ag/682710.
Original change description:
This change adds a missing call to offsetLocation() when tracking
swipe velocities on a SwipeDismissLayout.  This bug was causing
incorrect velocities to be measured which often resulted in an
incorrectly interpreted leftward swipe cancelling the dismiss
gesture.

Bug: 20350515
Change-Id: I4f3e3668a1f9aab963fdfa9095a43f4c5344703f
This commit is contained in:
Gus Prevas
2015-04-30 11:14:14 -04:00
parent a03e2658af
commit 026e204ee4

View File

@@ -216,6 +216,8 @@ public class SwipeDismissLayout extends FrameLayout {
if (mVelocityTracker == null) {
return super.onTouchEvent(ev);
}
// offset because the view is translated during swipe
ev.offsetLocation(mTranslationX, 0);
switch (ev.getActionMasked()) {
case MotionEvent.ACTION_UP:
updateDismiss(ev);