Program: 167665
Project: 167665
Buggy source:
@Override public boolean onTouch(final View view,MotionEvent event){
  pointToPosition=pointToPosition == null ? enclosingActivity.getListView().pointToPosition((int)event.getX(),(int)event.getY()) : pointToPosition;
  View childView=mListView.getChildAt(pointToPosition);
  if (childView == null) {
    return false;
  }
  if (mSwipeSlop < 0) {
    mSwipeSlop=ViewConfiguration.get(enclosingActivity).getScaledTouchSlop();
  }
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
    if (mItemPressed) {
      return false;
    }
  mItemPressed=true;
mDownX=event.getX();
break;
case MotionEvent.ACTION_CANCEL:
childView.setAlpha(1);
childView.setTranslationX(0);
mItemPressed=false;
break;
case MotionEvent.ACTION_MOVE:
{
float x=event.getX() + view.getTranslationX();
float deltaX=x - mDownX;
float deltaXAbs=Math.abs(deltaX);
if (!mSwiping) {
if (deltaXAbs > mSwipeSlop) {
mSwiping=true;
mListView.requestDisallowInterceptTouchEvent(true);
}
}
if (mSwiping) {
childView.setTranslationX((x - mDownX));
childView.setAlpha(1 - deltaXAbs / view.getWidth());
}
}
break;
case MotionEvent.ACTION_UP:
{
if (mSwiping) {
float x=event.getX() + view.getTranslationX();
float deltaX=x - mDownX;
float deltaXAbs=Math.abs(deltaX);
float fractionCovered;
float endX;
float endAlpha;
final boolean remove;
if (deltaXAbs > view.getWidth() * REMOVE_THRESHOLD) {
fractionCovered=deltaXAbs / childView.getWidth();
endX=deltaX < 0 ? -view.getWidth() : view.getWidth();
endAlpha=0;
remove=true;
}
 else {
fractionCovered=1 - (deltaXAbs / view.getWidth());
endX=0;
endAlpha=1;
remove=false;
}
long duration=(int)((1 - fractionCovered) * SWIPE_DURATION);
mListView.setEnabled(false);
if (remove) {
AlarmListAdapter adapter=(AlarmListAdapter)enclosingActivity.getListAdapter();
Alarm alarm=adapter.getItem(pointToPosition);
if (enclosingActivity.ismBound()) {
enclosingActivity.getmStorageAndControlService().deleteAlarm(alarm);
adapter.remove(pointToPosition);
}
 else {
Log.d("String_Node_Str" + alarm.getId());
}
mSwiping=false;
mListView.setEnabled(true);
}
 else {
mSwiping=false;
mListView.setEnabled(true);
childView.setAlpha(1);
childView.setTranslationX(0);
}
}
 else {
return false;
}
}
pointToPosition=null;
mItemPressed=false;
break;
default :
return false;
}
return true;
}

Fixed version (ground truth):
@Override public boolean onTouch(final View view,MotionEvent event){
  pointToPosition=pointToPosition == -1 ? enclosingActivity.getListView().pointToPosition((int)event.getX(),(int)event.getY()) : pointToPosition;
  View childView=mListView.getChildAt(pointToPosition);
  Log.d("String_Node_Str" + pointToPosition);
  if (childView == null) {
    return false;
  }
  if (mSwipeSlop < 0) {
    mSwipeSlop=ViewConfiguration.get(enclosingActivity).getScaledTouchSlop();
  }
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
    if (mItemPressed) {
      return false;
    }
  mItemPressed=true;
mDownX=event.getX();
break;
case MotionEvent.ACTION_CANCEL:
childView.setAlpha(1);
childView.setTranslationX(0);
mItemPressed=false;
break;
case MotionEvent.ACTION_MOVE:
{
float x=event.getX() + view.getTranslationX();
float deltaX=x - mDownX;
float deltaXAbs=Math.abs(deltaX);
if (!mSwiping) {
if (deltaXAbs > mSwipeSlop) {
mSwiping=true;
mListView.requestDisallowInterceptTouchEvent(true);
}
}
if (mSwiping) {
childView.setTranslationX((x - mDownX));
childView.setAlpha(1 - deltaXAbs / view.getWidth());
}
}
break;
case MotionEvent.ACTION_UP:
{
if (mSwiping) {
float x=event.getX() + view.getTranslationX();
float deltaX=x - mDownX;
float deltaXAbs=Math.abs(deltaX);
float fractionCovered;
float endX;
float endAlpha;
final boolean remove;
if (deltaXAbs > view.getWidth() * REMOVE_THRESHOLD) {
fractionCovered=deltaXAbs / childView.getWidth();
endX=deltaX < 0 ? -view.getWidth() : view.getWidth();
endAlpha=0;
remove=true;
}
 else {
fractionCovered=1 - (deltaXAbs / view.getWidth());
endX=0;
endAlpha=1;
remove=false;
}
long duration=(int)((1 - fractionCovered) * SWIPE_DURATION);
mListView.setEnabled(false);
if (remove) {
AlarmListAdapter adapter=(AlarmListAdapter)enclosingActivity.getListAdapter();
Alarm alarm=adapter.getItem(pointToPosition);
if (enclosingActivity.ismBound()) {
enclosingActivity.getmStorageAndControlService().deleteAlarm(alarm);
adapter.remove(pointToPosition);
}
 else {
Log.d("String_Node_Str" + alarm.getId());
}
mSwiping=false;
mListView.setEnabled(true);
}
 else {
mSwiping=false;
mListView.setEnabled(true);
childView.setAlpha(1);
childView.setTranslationX(0);
}
}
 else {
return false;
}
}
pointToPosition=-1;
mItemPressed=false;
break;
default :
return false;
}
return true;
}