//    @SuppressLint("NewApi")
  public void fling(int velocityX, int velocityY) {

    CFUtil.Log("fling " + velocityY + ", " + velocityY);

    if (getChildCount() > 0) {
      int height = getHeight() - getPaddingBottom() - getPaddingTop();
      int width = getWidth() - getPaddingLeft() - getPaddingRight();
      //            int right = getChildAt(getChildCount()-1).getWidth();
      //            int bottom = getChildAt(getChildCount()-1).getHeight();

      // mScroller.springBack(getScrollX(), getScrollY(), 0, width, 0, getScrollRange());
      //            mScroller.startScroll(getScrollX(), getScrollY(), velocityX, velocityY, 1000);
      mScroller.fling(
          getScrollX(),
          getScrollY(),
          velocityX,
          velocityY,
          //            		0, Math.max(0, right - width),
          //            		0, Math.max(0, bottom - height),
          0,
          Math.max(0, getScrollRangeX()),
          0,
          Math.max(0, getScrollRangeY()),
          width / 2,
          height / 2);

      //            if (mFlingStrictSpan == null) {
      //                mFlingStrictSpan = StrictMode.enterCriticalSpan("ScrollView-fling");
      //            }

      //            postInvalidateOnAnimation();
      postInvalidate();
    }
  }
예제 #2
0
 public static void fling(
     Object paramObject,
     int paramInt1,
     int paramInt2,
     int paramInt3,
     int paramInt4,
     int paramInt5,
     int paramInt6,
     int paramInt7,
     int paramInt8,
     int paramInt9,
     int paramInt10) {
   ((OverScroller) paramObject)
       .fling(
           paramInt1,
           paramInt2,
           paramInt3,
           paramInt4,
           paramInt5,
           paramInt6,
           paramInt7,
           paramInt8,
           paramInt9,
           paramInt10);
 }
  // Starts the fling animation. Called both as a response to a fling gesture and as via the
  // public WebView#flingScroll(int, int) API.
  public void flingScroll(int velocityX, int velocityY) {
    final int scrollX = mDelegate.getContainerViewScrollX();
    final int scrollY = mDelegate.getContainerViewScrollY();
    final int rangeX = computeMaximumHorizontalScrollOffset();
    final int rangeY = computeMaximumVerticalScrollOffset();

    mScroller.fling(scrollX, scrollY, velocityX, velocityY, 0, rangeX, 0, rangeY);
    mDelegate.invalidate();
  }
 public void fling(
     int startX,
     int startY,
     int velocityX,
     int velocityY,
     int minX,
     int maxX,
     int minY,
     int maxY) {
   fling(startX, startY, velocityX, velocityY, minX, maxX, minY, maxY, 0, 0);
 }
 @Override
 public void fling(
     int startX,
     int startY,
     int velocityX,
     int velocityY,
     int minX,
     int maxX,
     int minY,
     int maxY,
     int overX,
     int overY) {
   mScroller.fling(startX, startY, velocityX, velocityY, minX, maxX, minY, maxY, overX, overY);
 }
 @Override
 protected void _startUsingVelocity(int initialX, int velocity) {
   mScroller.fling(
       initialX,
       0,
       velocity,
       0,
       mParent.getMinX(),
       mParent.getMaxX(),
       0,
       Integer.MAX_VALUE,
       10,
       0);
 }
예제 #7
0
 public void fling(
     int startX,
     int startY,
     int velocityX,
     int velocityY,
     int minX,
     int maxX,
     int minY,
     int maxY) {
   if (isPreGingerbread) {
     scroller.fling(startX, startY, velocityX, velocityY, minX, maxX, minY, maxY);
   } else {
     overScroller.fling(startX, startY, velocityX, velocityY, minX, maxX, minY, maxY);
   }
 }
    public void fling(
        int startX,
        int startY,
        int velocityX,
        int velocityY,
        int minX,
        int maxX,
        int minY,
        int maxY,
        int overX,
        int overY) {

      if (isOld) {
        ((Scroller) scroller).fling(startX, startY, velocityX, velocityY, minX, maxX, minY, maxY);
      } else {
        ((OverScroller) scroller)
            .fling(startX, startY, velocityX, velocityY, minX, maxX, minY, maxY, overX, overY);
      }
    }
        @Override
        public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {

          mScroller.fling(
              mRect.centerX(),
              mRect.centerY(),
              Math.round(velocityX),
              Math.round(velocityY),
              0,
              getWidth() - SIZE,
              0,
              getHeight() - SIZE,
              SIZE / 2,
              SIZE / 2);

          ViewCompat.postInvalidateOnAnimation(ScrollerView.this);

          return true;
        }
  public void fling(int velocityX) {
    if (getChildCount() > 0) {
      int width = getWidth() - getPaddingRight() - getPaddingLeft();
      int right = getChildAt(0).getWidth();

      if (DEBUG) {
        Log.d(TAG, "fling -> velocityX = " + velocityX);
        Log.d(TAG, "fling -> getScrollX() = " + getScrollX());
      }
      mScroller.fling(
          getScrollX(),
          getScrollY(),
          velocityX,
          0,
          0,
          Math.max(0, right - width),
          0,
          0,
          width / 2,
          0);

      int finalX = mScroller.getFinalX();
      int overX = 0;
      if (finalX <= 0 || finalX >= scrollPositionOfMostRecent()) {
        overX = width / 2;
      }

      finalX = getScrollXFromFinalX(finalX);
      if (DEBUG) {
        Log.d(TAG, "fling -> finalX = " + finalX);
      }
      mScroller.startScroll(
          getScrollX(), getScrollY(), finalX - getScrollX(), 0, getScrollTime(finalX));
      final boolean movingRight = velocityX > 0;

      postInvalidateOnAnimation();
    }
  }
 public void fling(int velocityY) {
   mOverScroller.fling(0, getScrollY(), 0, velocityY, 0, 0, 0, getHeaderViewHeight());
   invalidate();
 }
예제 #12
0
 public void fling(int velocity, int min, int max) {
   int currX = getPosition();
   mScroller.fling(
       currX, 0, velocity, 0, min, max, 0, 0, mOverflingEnabled ? mOverflingDistance : 0, 0);
 }