Program: 162729
Project: 162729
Buggy source:
@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) {
        mDownX=motionEvent.getRawX();
        Card card=(Card)mDownView.getTag();
        mDownPosition=mListView.getPosition(card);
        mVelocityTracker=VelocityTracker.obtain();
        mVelocityTracker.addMovement(motionEvent);
      }
      view.onTouchEvent(motionEvent);
      return true;
    }
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 && isCurrentItemDismissable()) {
      final View downView=mDownView;
      final int downPosition=mDownPosition;
      ++mDismissAnimationRefCount;
      animate(mDownView).translationX(dismissRight ? mViewWidth : -mViewWidth).alpha(0).setDuration(mAnimationTime).setListener(new AnimatorListenerAdapter(){
        @Override public void onAnimationEnd(        Animator animation){
          performDismiss(downView,downPosition);
        }
      }
);
    }
 else {
      animate(mDownView).translationX(0).alpha(1).setDuration(mAnimationTime).setListener(null);
    }
    mVelocityTracker=null;
    mDownX=0;
    mDownView=null;
    mDownPosition=ListView.INVALID_POSITION;
    mSwiping=false;
    break;
  }
case MotionEvent.ACTION_MOVE:
{
  if (mDownPosition != ListView.INVALID_POSITION) {
    if (mListView.getAdapter().getItem(mDownPosition).isDismissible()) {
      if (mVelocityTracker == null || mPaused) {
        break;
      }
      mVelocityTracker.addMovement(motionEvent);
      float deltaX=motionEvent.getRawX() - mDownX;
      if (Math.abs(deltaX) > mSlop) {
        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(mDownView,deltaX);
        setAlpha(mDownView,Math.max(0f,Math.min(1f,1f - 2f * Math.abs(deltaX) / mViewWidth)));
        return true;
      }
      break;
    }
  }
}
}
return false;
}

Fixed version (ground truth):
@Override public boolean onTouch(View view,MotionEvent motionEvent){
  if (mListView.getAdapter().isEmpty()) {
    return false;
  }
  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) {
        mDownX=motionEvent.getRawX();
        Card card=(Card)mDownView.getTag();
        mDownPosition=mListView.getPosition(card);
        mVelocityTracker=VelocityTracker.obtain();
        mVelocityTracker.addMovement(motionEvent);
      }
      view.onTouchEvent(motionEvent);
      return true;
    }
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 && isCurrentItemDismissable()) {
      final View downView=mDownView;
      final int downPosition=mDownPosition;
      ++mDismissAnimationRefCount;
      animate(mDownView).translationX(dismissRight ? mViewWidth : -mViewWidth).alpha(0).setDuration(mAnimationTime).setListener(new AnimatorListenerAdapter(){
        @Override public void onAnimationEnd(        Animator animation){
          performDismiss(downView,downPosition);
        }
      }
);
    }
 else {
      animate(mDownView).translationX(0).alpha(1).setDuration(mAnimationTime).setListener(null);
    }
    mVelocityTracker=null;
    mDownX=0;
    mDownView=null;
    mDownPosition=ListView.INVALID_POSITION;
    mSwiping=false;
    break;
  }
case MotionEvent.ACTION_MOVE:
{
  if (mDownPosition != ListView.INVALID_POSITION) {
    if (mListView.getAdapter().getItem(mDownPosition).isDismissible()) {
      if (mVelocityTracker == null || mPaused) {
        break;
      }
      mVelocityTracker.addMovement(motionEvent);
      float deltaX=motionEvent.getRawX() - mDownX;
      if (Math.abs(deltaX) > mSlop) {
        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(mDownView,deltaX);
        setAlpha(mDownView,Math.max(0f,Math.min(1f,1f - 2f * Math.abs(deltaX) / mViewWidth)));
        return true;
      }
      break;
    }
  }
}
}
return false;
}