protected void adjustPositionY(int velocityY){
  if (reverseLayout)   velocityY*=-1;
  int childCount=getChildCount();
  if (childCount > 0) {
    int curPosition=ViewUtils.getCenterYChildPosition(this);
    int childHeight=getHeight() - getPaddingTop() - getPaddingBottom();
    int flingCount=getFlingCount(velocityY,childHeight);
    int targetPosition=curPosition + flingCount;
    if (mSinglePageFling) {
      flingCount=Math.max(-1,Math.min(1,flingCount));
      targetPosition=flingCount == 0 ? curPosition : mPositionOnTouchDown + flingCount;
    }
    targetPosition=Math.max(targetPosition,0);
    targetPosition=Math.min(targetPosition,getItemCount() - 1);
    if (targetPosition == curPosition && (!mSinglePageFling || mPositionOnTouchDown == curPosition)) {
      View centerYChild=ViewUtils.getCenterYChild(this);
      if (centerYChild != null) {
        if (mTouchSpan > centerYChild.getHeight() * mTriggerOffset && targetPosition != 0) {
          if (!reverseLayout)           targetPosition--;
 else           targetPosition++;
        }
 else         if (mTouchSpan < centerYChild.getHeight() * -mTriggerOffset && targetPosition != getItemCount() - 1) {
          if (!reverseLayout)           targetPosition++;
 else           targetPosition--;
        }
      }
    }
    if (DEBUG) {
      Log.d("@","mTouchSpan:" + mTouchSpan);
      Log.d("@","adjustPositionY:" + targetPosition);
    }
    smoothScrollToPosition(safeTargetPosition(targetPosition,getItemCount()));
  }
}

protected void adjustPositionY ( int velocityY ) { if ( reverseLayout ) velocityY *= - 1 ; int childCount = getChildCount ( ) ; if ( childCount > 0 ) { int curPosition = ViewUtils . getCenterYChildPosition ( this ) ; int childHeight = getHeight ( ) - getPaddingTop ( ) - getPaddingBottom ( ) ; int flingCount = getFlingCount ( velocityY , childHeight ) ; int targetPosition = curPosition + flingCount ; if ( mSinglePageFling ) { flingCount = Math . max ( - 1 , Math . min ( 1 , flingCount ) ) ; targetPosition = flingCount == 0 ? curPosition : mPositionOnTouchDown + flingCount ; } targetPosition = Math . max ( targetPosition , 0 ) ; targetPosition = Math . min ( targetPosition , getItemCount ( ) - 1 ) ; if ( targetPosition == curPosition && ( ! mSinglePageFling || mPositionOnTouchDown == curPosition ) ) { View centerYChild = ViewUtils . getCenterYChild ( this ) ; if ( centerYChild != null ) { if ( mTouchSpan > centerYChild . getHeight ( ) * mTriggerOffset && targetPosition != 0 ) { if ( ! reverseLayout ) targetPosition -- ; else targetPosition ++ ; } else if ( mTouchSpan < centerYChild . getHeight ( ) * - mTriggerOffset && targetPosition != getItemCount ( ) - 1 ) { if ( ! reverseLayout ) targetPosition ++ ; else targetPosition -- ; } } } if ( DEBUG ) { Log . d ( "@" , "mTouchSpan:" + mTouchSpan ) ; Log . d ( "@" , "adjustPositionY:" + targetPosition ) ; } smoothScrollToPosition ( safeTargetPosition ( targetPosition , getItemCount ( ) ) ) ; } }
adjust position before touch event complete and fling action start .
