// 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();
  }
예제 #2
0
 public float getCurrVelocity() {
   return mScroller.getCurrVelocity();
 }
 @TargetApi(14)
 @Override
 public float getCurrVelocity() {
   return mScroller.getCurrVelocity();
 }