private void performDrag(float x){
  float deltaX=lastMotionX - x;
  lastMotionX=x;
  if (virtualPos == 0) {
    if (deltaX < 0) {
      deltaX=-deltaX;
      reversePos=true;
    }
 else {
      reversePos=false;
    }
  }
 else   if (virtualPos > 0) {
    deltaX=-deltaX;
    reversePos=true;
  }
 else {
    reversePos=false;
  }
  float oldScrollX=getScrollX();
  float scrollX=oldScrollX + deltaX;
  final int width=getClientWidth();
  float leftBound=0;
  float rightBound=width * lastOffset;
  final ItemInfo currentItem=infoForPosition(this.currentItem);
  final ItemInfo lastItem=items.get(items.size() - 1);
  if (currentItem != null) {
    leftBound=currentItem.offset * width;
  }
  if (lastItem.position != pagerAdapter.getCount() - 1) {
    rightBound=lastItem.offset * width;
  }
  if (scrollX < leftBound) {
    scrollX=leftBound;
  }
 else   if (scrollX > rightBound) {
    scrollX=rightBound;
  }
  lastMotionX+=scrollX - (int)scrollX;
  scrollTo((int)scrollX,getScrollY());
  pageScrolled((int)scrollX);
}

private void performDrag ( float x ) { float deltaX = lastMotionX - x ; lastMotionX = x ; if ( virtualPos == 0 ) { if ( deltaX < 0 ) { deltaX = - deltaX ; reversePos = true ; } else { reversePos = false ; } } else if ( virtualPos > 0 ) { deltaX = - deltaX ; reversePos = true ; } else { reversePos = false ; } float oldScrollX = getScrollX ( ) ; float scrollX = oldScrollX + deltaX ; final int width = getClientWidth ( ) ; float leftBound = 0 ; float rightBound = width * lastOffset ; final ItemInfo currentItem = infoForPosition ( this . currentItem ) ; final ItemInfo lastItem = items . get ( items . size ( ) - 1 ) ; if ( currentItem != null ) { leftBound = currentItem . offset * width ; } if ( lastItem . position != pagerAdapter . getCount ( ) - 1 ) { rightBound = lastItem . offset * width ; } if ( scrollX < leftBound ) { scrollX = leftBound ; } else if ( scrollX > rightBound ) { scrollX = rightBound ; } lastMotionX += scrollX - ( int ) scrollX ; scrollTo ( ( int ) scrollX , getScrollY ( ) ) ; pageScrolled ( ( int ) scrollX ) ; }
perform a user initiated drag motion . does not allow scrolling backward .
