Program: 111134
Project: 111134
Buggy source:
@Override public void onScroll(AbsListView listview,int firstVisibleItem,int visibleItemCount,int totalItemCount){
  int scrollY=QuickReturnUtils.getScrollY(listview);
  int diff=mPrevScrollY - scrollY;
  if (diff > 0) {
switch (mQuickReturnType) {
case HEADER:
      if (mHeader.getVisibility() == View.GONE) {
        mHeader.setVisibility(View.VISIBLE);
        mHeader.startAnimation(mSlideHeaderDownAnimation);
      }
    break;
case FOOTER:
  if (mFooter.getVisibility() == View.GONE) {
    mFooter.setVisibility(View.VISIBLE);
    mFooter.startAnimation(mSlideFooterUpAnimation);
  }
break;
case BOTH:
if (mHeader.getVisibility() == View.GONE) {
mHeader.setVisibility(View.VISIBLE);
mHeader.startAnimation(mSlideHeaderDownAnimation);
}
if (mFooter.getVisibility() == View.GONE) {
mFooter.setVisibility(View.VISIBLE);
mFooter.startAnimation(mSlideFooterUpAnimation);
}
break;
case CUSTOM:
if (mHeaderViews != null) {
for (View view : mHeaderViews) {
if (view.getVisibility() == View.GONE) {
view.setVisibility(View.VISIBLE);
view.startAnimation(mSlideHeaderDownAnimation);
}
}
}
if (mFooterViews != null) {
for (View view : mFooterViews) {
int scrollThreshold=(Integer)view.getTag(R.id.scroll_threshold_key);
if (diff > scrollThreshold) {
if (view.getVisibility() == View.GONE) {
view.setVisibility(View.VISIBLE);
view.startAnimation(mSlideFooterUpAnimation);
}
}
}
}
break;
}
}
 else if (diff < 0) {
switch (mQuickReturnType) {
case HEADER:
if (mHeader.getVisibility() == View.VISIBLE) {
mHeader.setVisibility(View.GONE);
mHeader.startAnimation(mSlideHeaderUpAnimation);
}
break;
case FOOTER:
if (mFooter.getVisibility() == View.VISIBLE) {
mFooter.setVisibility(View.GONE);
mFooter.startAnimation(mSlideFooterDownAnimation);
}
break;
case BOTH:
if (mHeader.getVisibility() == View.VISIBLE) {
mHeader.setVisibility(View.GONE);
mHeader.startAnimation(mSlideHeaderUpAnimation);
}
if (mFooter.getVisibility() == View.VISIBLE) {
mFooter.setVisibility(View.GONE);
mFooter.startAnimation(mSlideFooterDownAnimation);
}
break;
case CUSTOM:
if (mHeaderViews != null) {
for (View view : mHeaderViews) {
if (view.getVisibility() == View.VISIBLE) {
view.setVisibility(View.GONE);
view.startAnimation(mSlideHeaderUpAnimation);
}
}
}
if (mFooterViews != null) {
for (View view : mFooterViews) {
int scrollThreshold=(Integer)view.getTag(R.id.scroll_threshold_key);
if (diff < -scrollThreshold) {
if (view.getVisibility() == View.VISIBLE) {
view.setVisibility(View.GONE);
view.startAnimation(mSlideFooterDownAnimation);
}
}
}
}
break;
}
}
mPrevScrollY=scrollY;
}

Fixed version (ground truth):
@Override public void onScroll(AbsListView listview,int firstVisibleItem,int visibleItemCount,int totalItemCount){
  int scrollY=QuickReturnUtils.getScrollY(listview);
  int diff=mPrevScrollY - scrollY;
  if (diff > 0) {
switch (mQuickReturnType) {
case HEADER:
      if (mHeader.getVisibility() == View.GONE) {
        mHeader.setVisibility(View.VISIBLE);
        mHeader.startAnimation(mSlideHeaderDownAnimation);
      }
    break;
case FOOTER:
  if (mFooter.getVisibility() == View.GONE) {
    mFooter.setVisibility(View.VISIBLE);
    mFooter.startAnimation(mSlideFooterUpAnimation);
  }
break;
case BOTH:
if (mHeader.getVisibility() == View.GONE) {
mHeader.setVisibility(View.VISIBLE);
mHeader.startAnimation(mSlideHeaderDownAnimation);
}
if (mFooter.getVisibility() == View.GONE) {
mFooter.setVisibility(View.VISIBLE);
mFooter.startAnimation(mSlideFooterUpAnimation);
}
break;
case GOOGLE_PLUS:
if (mHeaderViews != null) {
for (View view : mHeaderViews) {
if (view.getVisibility() == View.GONE) {
view.setVisibility(View.VISIBLE);
view.startAnimation(mSlideHeaderDownAnimation);
}
}
}
if (mFooterViews != null) {
for (View view : mFooterViews) {
int scrollThreshold=(Integer)view.getTag(R.id.scroll_threshold_key);
if (diff > scrollThreshold) {
if (view.getVisibility() == View.GONE) {
view.setVisibility(View.VISIBLE);
view.startAnimation(mSlideFooterUpAnimation);
}
}
}
}
break;
}
}
 else if (diff < 0) {
switch (mQuickReturnType) {
case HEADER:
if (mHeader.getVisibility() == View.VISIBLE) {
mHeader.setVisibility(View.GONE);
mHeader.startAnimation(mSlideHeaderUpAnimation);
}
break;
case FOOTER:
if (mFooter.getVisibility() == View.VISIBLE) {
mFooter.setVisibility(View.GONE);
mFooter.startAnimation(mSlideFooterDownAnimation);
}
break;
case BOTH:
if (mHeader.getVisibility() == View.VISIBLE) {
mHeader.setVisibility(View.GONE);
mHeader.startAnimation(mSlideHeaderUpAnimation);
}
if (mFooter.getVisibility() == View.VISIBLE) {
mFooter.setVisibility(View.GONE);
mFooter.startAnimation(mSlideFooterDownAnimation);
}
break;
case GOOGLE_PLUS:
if (mHeaderViews != null) {
for (View view : mHeaderViews) {
if (view.getVisibility() == View.VISIBLE) {
view.setVisibility(View.GONE);
view.startAnimation(mSlideHeaderUpAnimation);
}
}
}
if (mFooterViews != null) {
for (View view : mFooterViews) {
int scrollThreshold=(Integer)view.getTag(R.id.scroll_threshold_key);
if (diff < -scrollThreshold) {
if (view.getVisibility() == View.VISIBLE) {
view.setVisibility(View.GONE);
view.startAnimation(mSlideFooterDownAnimation);
}
}
}
}
break;
}
}
mPrevScrollY=scrollY;
}