private void animateOffsetTo(
      final CoordinatorLayout coordinatorLayout, final AppBarLayout child, int offset) {
    if (mAnimator == null) {
      mAnimator = ViewUtils.createAnimator();
      mAnimator.setInterpolator(AnimationUtils.DECELERATE_INTERPOLATOR);
      mAnimator.setUpdateListener(
          new ValueAnimatorCompat.AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(ValueAnimatorCompat animator) {

              setHeaderTopBottomOffset(coordinatorLayout, child, animator.getAnimatedIntValue());
            }
          });
    } else {
      mAnimator.cancel();
    }
    mAnimator.setIntValues(getTopBottomOffsetForScrollingSibling(), offset);
    mAnimator.setDuration(300);
    mAnimator.start();
  }
Пример #2
0
 static ViewUtilsAnimator newInstance() {
   ValueAnimatorCompat animator = ViewUtils.createAnimator();
   animator.setInterpolator(AnimationUtils.FAST_OUT_SLOW_IN_INTERPOLATOR);
   return new ViewUtilsAnimator(animator);
 }