Buggy code:
public class SwipeDismissListViewTouchListener implements View . OnTouchListener { private int mSlop ; private int mMinFlingVelocity ; private int mMaxFlingVelocity ; private long mAnimationTime ; private ListView mListView ; private SwipeDismissListViewTouchListener . OnDismissCallback mCallback ; private int mViewWidth = 1 ; private List < SwipeDismissListViewTouchListener . PendingDismissData > mPendingDismisses = new ArrayList < SwipeDismissListViewTouchListener . PendingDismissData > ( ) ; private int mDismissAnimationRefCount = 0 ; private float mDownX ; private boolean mSwiping ; private VelocityTracker mVelocityTracker ; private int mDownPosition ; private View mDownView ; private boolean mPaused ; private int mfrontViewId ; private View mSwipeingView ; public interface OnDismissCallback { void onDismiss ( ListView listView , int [ ] reverseSortedPositions ) { } void onChangeDone ( ListView listView , int pos ) { } } public SwipeDismissListViewTouchListener ( ListView listView , SwipeDismissListViewTouchListener . OnDismissCallback callback , int frontViewId ) { } public void setEnabled ( boolean enabled ) { } public OnScrollListener makeScrollListener ( ) { } @ Override public boolean onTouch ( View view , MotionEvent motionEvent ) { if ( ( mViewWidth ) < 2 ) { mViewWidth = mListView . getWidth ( ) ; } switch ( motionEvent . getActionMasked ( ) ) { case MotionEvent . ACTION_DOWN : { if ( mPaused ) { return false ; } Rect rect = new Rect ( ) ; int childCount = mListView . getChildCount ( ) ; int [ ] listViewCoords = new int [ 2 ] ; mListView . getLocationOnScreen ( listViewCoords ) ; int x = ( ( int ) ( motionEvent . getRawX ( ) ) ) - ( listViewCoords [ 0 ] ) ; int y = ( ( int ) ( motionEvent . getRawY ( ) ) ) - ( listViewCoords [ 1 ] ) ; View child ; for ( int i = 0 ; i < childCount ; i ++ ) { child = mListView . getChildAt ( i ) ; child . getHitRect ( rect ) ; if ( rect . contains ( x , y ) ) { mDownView = child ; break ; } } if ( ( mDownView ) != null ) { mSwipeingView = mDownView . findViewById ( mfrontViewId ) ; mDownX = motionEvent . getRawX ( ) ; mDownPosition = ( mListView . getPositionForView ( mDownView ) ) - 1 ; mVelocityTracker = VelocityTracker . obtain ( ) ; mVelocityTracker . addMovement ( motionEvent ) ; } view . onTouchEvent ( motionEvent ) ; return true ; } case MotionEvent . ACTION_MOVE : { if ( ( ( mVelocityTracker ) == null ) || ( mPaused ) ) { break ; } mVelocityTracker . addMovement ( motionEvent ) ; float deltaX = ( motionEvent . getRawX ( ) ) - ( mDownX ) ; <START_BUG> if ( ( Math . abs ( deltaX ) ) > ( mSlop ) ) { <END_BUG> mSwiping = true ; mListView . requestDisallowInterceptTouchEvent ( true ) ; MotionEvent cancelEvent = MotionEvent . obtain ( motionEvent ) ; cancelEvent . setAction ( ( ( MotionEvent . ACTION_CANCEL ) | ( ( motionEvent . getActionIndex ( ) ) << ( MotionEvent . ACTION_POINTER_INDEX_SHIFT ) ) ) ) ; mListView . onTouchEvent ( cancelEvent ) ; } if ( mSwiping ) { setTranslationX ( mSwipeingView , deltaX ) ; if ( deltaX < 0 ) setAlpha ( mSwipeingView , Math . max ( 0.0F , Math . min ( 1.0F , ( 1.0F - ( ( 2.0F * ( Math . abs ( deltaX ) ) ) // ( mViewWidth ) ) ) ) ) ) ; else if ( ( deltaX > 0 ) && ( deltaX < ( ( mViewWidth ) // 2 ) ) ) { } return true ; } break ; } case MotionEvent . ACTION_UP : { if ( ( mVelocityTracker ) == null ) { break ; } float deltaX = ( motionEvent . getRawX ( ) ) - ( mDownX ) ; mVelocityTracker . addMovement ( motionEvent ) ; mVelocityTracker . computeCurrentVelocity ( 1000 ) ; float velocityX = Math . abs ( mVelocityTracker . getXVelocity ( ) ) ; float velocityY = Math . abs ( mVelocityTracker . getYVelocity ( ) ) ; boolean dismiss = false ; boolean dismissRight = false ; if ( ( Math . abs ( deltaX ) ) > ( ( mViewWidth ) // 2 ) ) { dismiss = true ; dismissRight = deltaX > 0 ; } else if ( ( ( ( mMinFlingVelocity ) <= velocityX ) && ( velocityX <= ( mMaxFlingVelocity ) ) ) && ( velocityY < velocityX ) ) { dismiss = true ; dismissRight = ( mVelocityTracker . getXVelocity ( ) ) > 0 ; } if ( dismiss ) { if ( ! dismissRight ) { final View downView = mDownView ; final int downPosition = mDownPosition ; ++ ( mDismissAnimationRefCount ) ; animate ( mSwipeingView ) . translationX ( ( - ( mViewWidth ) ) ) . alpha ( 0 ) . setDuration ( mAnimationTime ) . setListener ( new AnimatorListenerAdapter ( ) { @ Override public void onAnimationEnd ( Animator animation ) { performDismiss ( downView , downPosition ) ; } } ) ; } else { animate ( mSwipeingView ) . translationX ( 0 ) . setDuration ( mAnimationTime ) . alpha ( 1 ) . setListener ( null ) ; mCallback . onChangeDone ( mListView , mDownPosition ) ; } } else { animate ( mDownView ) . translationX ( 0 ) . alpha ( 1 ) . setDuration ( mAnimationTime ) . setListener ( null ) ; } mVelocityTracker = null ; mDownX = 0 ; mDownView = null ; mDownPosition = ListView . INVALID_POSITION ; mSwiping = false ; break ; } } return false ; } class PendingDismissData implements Comparable < SwipeDismissListViewTouchListener . PendingDismissData > { public int position ; public View view ; public PendingDismissData ( int position , View view ) { }

Fix:
if ( ( ( Math . abs ( deltaX ) ) > ( mSlop ) ) && ( ( mSwipeingView ) != null ) ) {