Пример #1
0
  @Override
  public void computeScroll() {
    if (mScroller.computeScrollOffset()) {
      mContentView.scrollTo(mScroller.getCurrX(), mScroller.getCurrY());
      postInvalidate();
      // LeeLog.p("currX " + mScroller.getCurrX());

      if (Math.abs(mScroller.getCurrX()) >= getWidth()) {
        if (mSildingListener != null) {
          mSildingListener.onSilding(true);
        }
      }

      if (mScroller.isFinished()) {
        LeeLog.p("mScroller.isFinished()");
      }
    }
  }
Пример #2
0
 private void actionMove(MotionEvent event) {
   if (canScroll(event)) {
     oldScrollX = scrollX;
     int sildX = (int) (oldX - event.getX());
     scrollX += sildX;
     LeeLog.p("scrollX " + scrollX);
     if (mSlideOrientation == SLIDING_LEFT) {
       if (scrollX < 0) {
         sildX = (int) -oldScrollX;
         scrollX = 0;
       }
     } else if (mSlideOrientation == SLIDING_RIGHT) {
       if (scrollX > 0) {
         sildX = (int) -oldScrollX;
         scrollX = 0;
       }
     }
     mContentView.scrollBy(sildX, 0);
   }
 }