From 6de596c2dddcf909ea788ee06197b3a5a62ff0ea Mon Sep 17 00:00:00 2001 From: Marek Oszczyk Date: Tue, 28 Apr 2015 13:07:14 +0200 Subject: [PATCH 1/3] Fix stutter when card is moved in opposite direction - Bug: start moving > change direction: when abs(delta) > slop, the touch is cancelled --- .../library/view/listener/SwipeDismissViewTouchListener.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/library-core/src/main/java/it/gmariotti/cardslib/library/view/listener/SwipeDismissViewTouchListener.java b/library-core/src/main/java/it/gmariotti/cardslib/library/view/listener/SwipeDismissViewTouchListener.java index b7fa2c98..3f51cf60 100644 --- a/library-core/src/main/java/it/gmariotti/cardslib/library/view/listener/SwipeDismissViewTouchListener.java +++ b/library-core/src/main/java/it/gmariotti/cardslib/library/view/listener/SwipeDismissViewTouchListener.java @@ -224,7 +224,8 @@ public void onAnimationEnd(Animator animation) { mVelocityTracker.addMovement(motionEvent); float deltaX = motionEvent.getRawX() - mDownX; float deltaY = motionEvent.getRawY() - mDownY; - if (Math.abs(deltaX) > mSlop && Math.abs(deltaY) < Math.abs(deltaX) / 2) { + if (Math.abs(deltaX) > mSlop && Math.abs(deltaY) < Math.abs(deltaX) / 2 + && !mSwiping) { mSwiping = true; ((View)mCardView).getParent().requestDisallowInterceptTouchEvent(true); mSwipingSlop = (deltaX > 0 ? mSlop : -mSlop); From 16d29a8f7ae4e90a108b5ce10a0d522c297de1ec Mon Sep 17 00:00:00 2001 From: Marek Oszczyk Date: Tue, 28 Apr 2015 17:12:14 +0200 Subject: [PATCH 2/3] Revert "Fix stutter when card is moved in opposite direction" This reverts commit 6de596c2dddcf909ea788ee06197b3a5a62ff0ea. --- .../library/view/listener/SwipeDismissViewTouchListener.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/library-core/src/main/java/it/gmariotti/cardslib/library/view/listener/SwipeDismissViewTouchListener.java b/library-core/src/main/java/it/gmariotti/cardslib/library/view/listener/SwipeDismissViewTouchListener.java index 3f51cf60..b7fa2c98 100644 --- a/library-core/src/main/java/it/gmariotti/cardslib/library/view/listener/SwipeDismissViewTouchListener.java +++ b/library-core/src/main/java/it/gmariotti/cardslib/library/view/listener/SwipeDismissViewTouchListener.java @@ -224,8 +224,7 @@ public void onAnimationEnd(Animator animation) { mVelocityTracker.addMovement(motionEvent); float deltaX = motionEvent.getRawX() - mDownX; float deltaY = motionEvent.getRawY() - mDownY; - if (Math.abs(deltaX) > mSlop && Math.abs(deltaY) < Math.abs(deltaX) / 2 - && !mSwiping) { + if (Math.abs(deltaX) > mSlop && Math.abs(deltaY) < Math.abs(deltaX) / 2) { mSwiping = true; ((View)mCardView).getParent().requestDisallowInterceptTouchEvent(true); mSwipingSlop = (deltaX > 0 ? mSlop : -mSlop); From 8dab776e5d32985b2939e1cdecc846cc76af6040 Mon Sep 17 00:00:00 2001 From: Marek Oszczyk Date: Tue, 28 Apr 2015 17:14:18 +0200 Subject: [PATCH 3/3] Fix stutter when card is moved in opposite direction - Bug: start moving > change direction: when abs(delta) > slop, the touch is cancelled --- .../library/view/listener/SwipeDismissViewTouchListener.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/library-core/src/main/java/it/gmariotti/cardslib/library/view/listener/SwipeDismissViewTouchListener.java b/library-core/src/main/java/it/gmariotti/cardslib/library/view/listener/SwipeDismissViewTouchListener.java index b7fa2c98..3f51cf60 100644 --- a/library-core/src/main/java/it/gmariotti/cardslib/library/view/listener/SwipeDismissViewTouchListener.java +++ b/library-core/src/main/java/it/gmariotti/cardslib/library/view/listener/SwipeDismissViewTouchListener.java @@ -224,7 +224,8 @@ public void onAnimationEnd(Animator animation) { mVelocityTracker.addMovement(motionEvent); float deltaX = motionEvent.getRawX() - mDownX; float deltaY = motionEvent.getRawY() - mDownY; - if (Math.abs(deltaX) > mSlop && Math.abs(deltaY) < Math.abs(deltaX) / 2) { + if (Math.abs(deltaX) > mSlop && Math.abs(deltaY) < Math.abs(deltaX) / 2 + && !mSwiping) { mSwiping = true; ((View)mCardView).getParent().requestDisallowInterceptTouchEvent(true); mSwipingSlop = (deltaX > 0 ? mSlop : -mSlop);