Program: 32623
Project: 32623
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,final AtomicBoolean itemScrolledToMiddle,final AtomicBoolean oneViewScrolled){
  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) {
          if (!mDummyTouched) {
            mDummyView.setVisibility(View.VISIBLE);
          }
          mMonthOrYearTouched=true;
        }
 else {
          mDummyTouched=false;
          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();
          }
        }
      }
      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;
        if (listView.getId() == R.id.date_listview) {
          mDummyTouched=true;
        }
      }
      return false;
    }
  }
);
  listView.setOnScrollListener(new OnScrollListener(){
    public void onScroll(    AbsListView view,    int firstVisibleItem,    int visibleItemCount,    int totalItemCount){
      if (listView.getId() != R.id.date_listview) {
        View cc=null;
        if (!oneViewScrolled.get()) {
          int position=mMiddlePositionFromTop;
          cc=listView.getChildAt(position);
          if (cc != null) {
            cc.setTag(String.valueOf(listView.getId()));
            oneViewScrolled.set(true);
          }
        }
        View c=listView.findViewWithTag(String.valueOf(listView.getId()));
        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,oneViewScrolled);
          }
        }
      }
 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 (listView.getId() == R.id.month_listview || listView.getId() == R.id.year_listview) {
          putDayOnDummyView();
        }
      }
      if (scrollState == OnScrollListener.SCROLL_STATE_IDLE && !listBeingTouched.get()) {
        putSomeRowInMiddle(listView,adapter);
        itemScrolledToMiddle.set(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,final AtomicBoolean oneViewScrolled){
  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) {
          if (!mDummyTouched) {
            mDummyView.setVisibility(View.VISIBLE);
          }
          mMonthOrYearTouched=true;
        }
 else {
          mDummyTouched=false;
          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();
          }
        }
      }
      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;
        if (listView.getId() == R.id.date_listview) {
          mDummyTouched=true;
        }
      }
      return false;
    }
  }
);
  listView.setOnScrollListener(new OnScrollListener(){
    public void onScroll(    AbsListView view,    int firstVisibleItem,    int visibleItemCount,    int totalItemCount){
      if (listView.getId() != R.id.date_listview) {
        View cc=null;
        if (!oneViewScrolled.get()) {
          int position=mMiddlePositionFromTop;
          cc=listView.getChildAt(position);
          if (cc != null) {
            cc.setTag(String.valueOf(listView.getId()));
            oneViewScrolled.set(true);
          }
        }
        View c=listView.findViewWithTag(String.valueOf(listView.getId()));
        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,oneViewScrolled);
          }
        }
      }
 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 (listView.getId() == R.id.month_listview || listView.getId() == R.id.year_listview) {
        }
      }
      if (scrollState == OnScrollListener.SCROLL_STATE_IDLE && !listBeingTouched.get()) {
        putSomeRowInMiddle(listView,adapter);
        itemScrolledToMiddle.set(true);
      }
    }
  }
);
}