示例#1
0
  private void onDrawInScrolling(Canvas canvas) {
    final ZLView view = ZLApplication.Instance().getCurrentView();

    //		final int w = getWidth();
    //		final int h = getMainAreaHeight();

    final AnimationProvider animator = getAnimationProvider();
    final AnimationProvider.Mode oldMode = animator.getMode();
    animator.doStep();
    if (animator.inProgress()) {
      animator.draw(canvas);
      if (animator.getMode().Auto) {
        postInvalidate();
      }
      drawFooter(canvas);
    } else {
      switch (oldMode) {
        case AnimatedScrollingForward:
          {
            final ZLView.PageIndex index = animator.getPageToScrollTo();
            myBitmapManager.shift(index == ZLView.PageIndex.next);
            view.onScrollingFinished(index);
            ZLApplication.Instance().onRepaintFinished();
            break;
          }
        case AnimatedScrollingBackward:
          view.onScrollingFinished(ZLView.PageIndex.current);
          break;
      }
      onDrawStatic(canvas);
    }
  }
示例#2
0
 @Override
 protected int computeVerticalScrollOffset() {
   final ZLView view = ZLApplication.Instance().getCurrentView();
   if (!view.isScrollbarShown()) {
     return 0;
   }
   final AnimationProvider animator = getAnimationProvider();
   if (animator.inProgress()) {
     final int from = view.getScrollbarThumbPosition(ZLView.PageIndex.current);
     final int to = view.getScrollbarThumbPosition(animator.getPageToScrollTo());
     final int percent = animator.getScrolledPercent();
     return (from * (100 - percent) + to * percent) / 100;
   } else {
     return view.getScrollbarThumbPosition(ZLView.PageIndex.current);
   }
 }