コード例 #1
1
ファイル: TouchImageView.java プロジェクト: mkodekar/YASFA1
 public boolean computeScrollOffset() {
   if (isPreGingerbread) {
     return scroller.computeScrollOffset();
   } else {
     overScroller.computeScrollOffset();
     return overScroller.computeScrollOffset();
   }
 }
コード例 #2
1
 @Override
 public boolean computeScrollOffset() {
   // Workaround for first scroll returning 0 for the direction of the edge it hits.
   // Simply recompute values.
   if (mFirstScroll) {
     mScroller.computeScrollOffset();
     mFirstScroll = false;
   }
   return mScroller.computeScrollOffset();
 }
コード例 #3
1
 @Override
 public void computeScroll() {
   if (mOverScroller.computeScrollOffset()) {
     scrollTo(0, mOverScroller.getCurrY());
     invalidate();
   }
 }
コード例 #4
1
  @Override
  public void computeScroll() {
    if (mScroller.computeScrollOffset()) {
      // This is called at drawing time by ViewGroup.  We don't want to
      // re-show the scrollbars at this point, which scrollTo will do,
      // so we replicate most of scrollTo here.
      //
      //         It's a little odd to call onScrollChanged from inside the drawing.
      //
      //         It is, except when you remember that computeScroll() is used to
      //         animate scrolling. So unless we want to defer the onScrollChanged()
      //         until the end of the animated scrolling, we don't really have a
      //         choice here.
      //
      //         I agree.  The alternative, which I think would be worse, is to post
      //         something and tell the subclasses later.  This is bad because there
      //         will be a window where mScrollX/Y is different from what the app
      //         thinks it is.
      //
      int oldX = getScrollX(); // mScrollX;
      int oldY = getScrollY(); // mScrollY;
      int x = mScroller.getCurrX();
      int y = mScroller.getCurrY();

      CFUtil.Log("sx=" + x + ", sy=" + y);

      if (oldX != x || oldY != y) {
        final int rangeY = getScrollRangeY();
        // final int overscrollMode = getOverScrollMode();
        // final boolean canOverscroll = overscrollMode == OVER_SCROLL_ALWAYS ||
        //        (overscrollMode == OVER_SCROLL_IF_CONTENT_SCROLLS && range > 0);

        //                overScrollBy(x - oldX, y - oldY, oldX, oldY, 0, range,
        //                        0, mOverflingDistance, false);
        scrollTo(x, y);
        onScrollChanged(getScrollX(), getScrollY(), oldX, oldY);

        //                if (canOverscroll) {
        //                    if (y < 0 && oldY >= 0) {
        //                        mEdgeGlowTop.onAbsorb((int) mScroller.getCurrVelocity());
        //                    } else if (y > range && oldY <= range) {
        //                        mEdgeGlowBottom.onAbsorb((int) mScroller.getCurrVelocity());
        //                    }
        //                }
      }

      postInvalidate();
      //            if (!awakenScrollBars()) {
      //                // Keep on drawing until the animation has finished.
      //                postInvalidateOnAnimation();
      //            }

    }
    //        else {
    //            if (mFlingStrictSpan != null) {
    //                mFlingStrictSpan.finish();
    //                mFlingStrictSpan = null;
    //            }
    //        }
  }
コード例 #5
1
  @Override
  public void computeScroll() {
    super.computeScroll();

    if (mScroller.computeScrollOffset()) {
      mRect.offsetTo(mScroller.getCurrX(), mScroller.getCurrY());

      ViewCompat.postInvalidateOnAnimation(this);
    }
  }
コード例 #6
0
 /** Called from the view draw, computes the next scroll. */
 boolean computeScroll() {
   Log.d(TAG, "computeScroll: ");
   if (mScroller.computeScrollOffset()) {
     float scroll = scrollRangeToProgress(mScroller.getCurrY());
     setStackScrollRaw(scroll);
     if (mCb != null) {
       mCb.onScrollChanged(scroll);
     }
     return true;
   }
   return false;
 }
コード例 #7
0
  @Override
  public void computeScroll() {
    if (mScroller.computeScrollOffset()) {
      // This is called at drawing time by ViewGroup. We don't want to
      // re-show the scrollbars at this point, which scrollTo will do,
      // so we replicate most of scrollTo here.
      //
      // It's a little odd to call onScrollChanged from inside the drawing.
      //
      // It is, except when you remember that computeScroll() is used to
      // animate scrolling. So unless we want to defer the onScrollChanged()
      // until the end of the animated scrolling, we don't really have a
      // choice here.
      //
      // I agree. The alternative, which I think would be worse, is to post
      // something and tell the subclasses later. This is bad because there
      // will be a window where mScrollX/Y is different from what the app
      // thinks it is.
      //
      int oldX = getScrollX();
      int oldY = getScrollY();
      int x = mScroller.getCurrX();
      int y = mScroller.getCurrY();

      if (oldX != x || oldY != y) {
        final int range = getScrollRange();
        final int overscrollMode = getOverScrollMode();
        final boolean canOverscroll =
            overscrollMode == OVER_SCROLL_ALWAYS
                || (overscrollMode == OVER_SCROLL_IF_CONTENT_SCROLLS && range > 0);

        overScrollBy(x - oldX, y - oldY, oldX, oldY, range, 0, mOverflingDistance, 0, false);
        onScrollChanged(getScrollX(), getScrollY(), oldX, oldY);
      }

      if (!awakenScrollBars()) {
        postInvalidateOnAnimation();
      }
    } else {
      int scrollX = getScrollX();
      int finalX = getScrollXFromFinalX(scrollX);

      if (!mIsBeingDragged && scrollX != finalX) {
        if (mScroller.springBack(getScrollX(), getScrollY(), finalX, finalX, 0, 0)) {
          postInvalidateOnAnimation();
        }
      }
    }
  }
コード例 #8
0
  // Called immediately before the draw to update the scroll offset.
  public void computeScrollAndAbsorbGlow(OverScrollGlow overScrollGlow) {
    final boolean stillAnimating = mScroller.computeScrollOffset();
    if (!stillAnimating) return;

    final int oldX = mDelegate.getContainerViewScrollX();
    final int oldY = mDelegate.getContainerViewScrollY();
    int x = mScroller.getCurrX();
    int y = mScroller.getCurrY();

    int rangeX = computeMaximumHorizontalScrollOffset();
    int rangeY = computeMaximumVerticalScrollOffset();

    if (overScrollGlow != null) {
      overScrollGlow.absorbGlow(x, y, oldX, oldY, rangeX, rangeY, mScroller.getCurrVelocity());
    }

    // The mScroller is configured not to go outside of the scrollable range, so this call
    // should never result in attempting to scroll outside of the scrollable region.
    scrollBy(x - oldX, y - oldY);

    mDelegate.invalidate();
  }
コード例 #9
0
ファイル: ScrollerProxy.java プロジェクト: XueXiaobo/MyCode
 @Override
 public boolean computeScrollOffset() {
   return mScroller.computeScrollOffset();
 }
コード例 #10
0
 /**
  * Call this when you want to know the new location. The position will be updated and can be
  * obtained by getPosition(). Returns true if the animation is not yet finished.
  */
 public boolean advanceAnimation(long currentTimeMillis) {
   return mScroller.computeScrollOffset();
 }
コード例 #11
0
 @Override
 protected boolean computeScrollOffset() {
   return mScroller.computeScrollOffset();
 }