Program: 32632
Project: 32632
Buggy source:
private void setListenersOnListView(final MonthYearAdapter adapter,final ListView listView,final AtomicBoolean listBeingTouched,final ScrollState state,final ListViewVisible completeListVisible,final AtomicInteger firstVisiblePosition,final AtomicBoolean lowerHalf,final AtomicInteger initialPosition,final int startingPositionOfScroll,final StringBuilder firstVisibleText){
  state.setScrollState(OnScrollListener.SCROLL_STATE_IDLE);
  listView.setOnTouchListener(new OnTouchListener(){
    @Override public boolean onTouch(    View v,    MotionEvent event){
      if (event.getAction() == MotionEvent.ACTION_DOWN) {
        if (listView.getId() == R.id.month_listview || listView.getId() == R.id.year_listview) {
          mMonthOrYearTouched=true;
        }
 else {
          mDummyView.setVisibility(View.INVISIBLE);
        }
        mItemMovedToMiddle=false;
        if (ACTION_MOVED == 1) {
          if (state.getScrollState() == OnScrollListener.SCROLL_STATE_TOUCH_SCROLL || state.getScrollState() == OnScrollListener.SCROLL_STATE_FLING)           ACTION_MOVED=1;
 else           if (state.getScrollState() == OnScrollListener.SCROLL_STATE_IDLE)           ACTION_MOVED=0;
        }
        disableOtherListViews(listView);
        setOtherListViewsInvisible(listView);
        stopOtherScrolls(listView);
        listBeingTouched.set(true);
        if (!adapter.getAllItemsVisible()) {
          adapter.setAllItemsVisible(true);
          adapter.notifyDataSetChanged();
        }
        if (state.getScrollState() == OnScrollListener.SCROLL_STATE_IDLE && mMonthOrYearTouched) {
          if (listView.getId() == R.id.date_listview) {
            addDatesInDateView();
          }
        }
 else         if (state.getScrollState() == OnScrollListener.SCROLL_STATE_TOUCH_SCROLL) {
        }
      }
      if (event.getAction() == MotionEvent.ACTION_UP) {
        enableAllListViews();
        listBeingTouched.compareAndSet(true,false);
        if (ACTION_MOVED != 1) {
          if (completeListVisible.isCompleteListViewVisible()) {
            putThisViewInMiddle(event.getY(),listView,adapter);
          }
        }
        if (state.getScrollState() == OnScrollListener.SCROLL_STATE_IDLE) {
          completeListVisible.setCompleteListViewVisible(true);
        }
      }
 else       if (event.getAction() == MotionEvent.ACTION_MOVE) {
        ACTION_MOVED=1;
      }
      return false;
    }
  }
);
  listView.setOnScrollListener(new OnScrollListener(){
    public void onScroll(    AbsListView view,    int firstVisibleItem,    int visibleItemCount,    int totalItemCount){
      if (listView.getId() != R.id.date_listview) {
        int position=-(listView.getFirstVisiblePosition() - firstVisiblePosition.get()) + mMiddlePositionFromTop;
        View c=listView.getChildAt(position);
        if (c != null) {
          int heightOfView=c.getHeight() / 2;
          if (c.getTop() != 0 && c.getTop() > 0) {
            fadeView(c,c.getTop(),heightOfView,listView,firstVisiblePosition,lowerHalf,initialPosition,startingPositionOfScroll,firstVisibleText);
          }
        }
      }
 else {
      }
    }
    public void onScrollStateChanged(    AbsListView view,    int scrollState){
      state.setScrollState(scrollState);
      mActionBar.getCustomView().findViewById(R.id.done).setVisibility(View.GONE);
      if (scrollState == OnScrollListener.SCROLL_STATE_IDLE) {
        mActionBar.getCustomView().findViewById(R.id.done).setVisibility(View.VISIBLE);
      }
      if (scrollState == OnScrollListener.SCROLL_STATE_IDLE && !listBeingTouched.get() && !mItemMovedToMiddle) {
        putSomeRowInMiddle(listView,adapter);
        mItemMovedToMiddle=true;
      }
    }
  }
);
}

Fixed version (ground truth):
private void setListenersOnListView(final MonthYearAdapter adapter,final ListView listView,final AtomicBoolean listBeingTouched,final ScrollState state,final ListViewVisible completeListVisible,final AtomicInteger firstVisiblePosition,final AtomicBoolean lowerHalf,final AtomicInteger initialPosition,final int startingPositionOfScroll,final StringBuilder firstVisibleText,final AtomicBoolean itemScrolledToMiddle){
  state.setScrollState(OnScrollListener.SCROLL_STATE_IDLE);
  listView.setOnTouchListener(new OnTouchListener(){
    @Override public boolean onTouch(    View v,    MotionEvent event){
      if (event.getAction() == MotionEvent.ACTION_DOWN) {
        if (listView.getId() == R.id.month_listview || listView.getId() == R.id.year_listview) {
          mMonthOrYearTouched=true;
        }
 else {
          mDummyView.setVisibility(View.INVISIBLE);
        }
        itemScrolledToMiddle.set(false);
        if (ACTION_MOVED == 1) {
          if (state.getScrollState() == OnScrollListener.SCROLL_STATE_TOUCH_SCROLL || state.getScrollState() == OnScrollListener.SCROLL_STATE_FLING)           ACTION_MOVED=1;
 else           if (state.getScrollState() == OnScrollListener.SCROLL_STATE_IDLE)           ACTION_MOVED=0;
        }
        disableOtherListViews(listView);
        setOtherListViewsInvisible(listView);
        stopOtherScrolls(listView);
        listBeingTouched.set(true);
        if (!adapter.getAllItemsVisible()) {
          adapter.setAllItemsVisible(true);
          adapter.notifyDataSetChanged();
        }
        if (state.getScrollState() == OnScrollListener.SCROLL_STATE_IDLE && mMonthOrYearTouched) {
          if (listView.getId() == R.id.date_listview) {
            addDatesInDateView();
          }
        }
 else         if (state.getScrollState() == OnScrollListener.SCROLL_STATE_TOUCH_SCROLL) {
        }
      }
      if (event.getAction() == MotionEvent.ACTION_UP) {
        enableAllListViews();
        listBeingTouched.compareAndSet(true,false);
        if (ACTION_MOVED != 1) {
          if (completeListVisible.isCompleteListViewVisible()) {
            putThisViewInMiddle(event.getY(),listView,adapter);
          }
        }
        if (state.getScrollState() == OnScrollListener.SCROLL_STATE_IDLE) {
          completeListVisible.setCompleteListViewVisible(true);
        }
      }
 else       if (event.getAction() == MotionEvent.ACTION_MOVE) {
        ACTION_MOVED=1;
      }
      return false;
    }
  }
);
  listView.setOnScrollListener(new OnScrollListener(){
    public void onScroll(    AbsListView view,    int firstVisibleItem,    int visibleItemCount,    int totalItemCount){
      if (listView.getId() != R.id.date_listview) {
        int position=-(listView.getFirstVisiblePosition() - firstVisiblePosition.get()) + mMiddlePositionFromTop;
        View c=listView.getChildAt(position);
        if (c != null) {
          int heightOfView=c.getHeight() / 2;
          if (c.getTop() != 0 && c.getTop() > 0) {
            fadeView(c,c.getTop(),heightOfView,listView,firstVisiblePosition,lowerHalf,initialPosition,startingPositionOfScroll,firstVisibleText);
          }
        }
      }
 else {
      }
    }
    public void onScrollStateChanged(    AbsListView view,    int scrollState){
      state.setScrollState(scrollState);
      mActionBar.getCustomView().findViewById(R.id.done).setVisibility(View.GONE);
      if (scrollState == OnScrollListener.SCROLL_STATE_IDLE) {
        mActionBar.getCustomView().findViewById(R.id.done).setVisibility(View.VISIBLE);
      }
      if (scrollState == OnScrollListener.SCROLL_STATE_IDLE && !listBeingTouched.get()) {
        putSomeRowInMiddle(listView,adapter);
        itemScrolledToMiddle.set(true);
      }
    }
  }
);
}