AppBarLayout.setExpanded (boolean, true) странная анимация в библиотеке поддержки 23.1.1

В моем приложении я расширяю или сжимаюAppBarLayout на конкретное событие, используяsetExpanded(boolean, true).

У меня хороший результат с быстрой и плавной анимацией с использованиемcom.android.support:design:23.1.0тогда я обновился до23.1.1 и анимация стала очень медленной и совсем не быстрой.

В исходном кодеandroid.support.design.widget.AppBarLayoutЯ нашел проблему вanimateOffsetTo (подpublic static class Behavior extends HeaderBehavior<AppBarLayout>), что в версии 23.1.0 было так:

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.start();
}

И в версии 23.1.1 это так:

private void animateOffsetTo(final CoordinatorLayout coordinatorLayout,
    final AppBarLayout child, final int offset) {
   final int currentOffset = getTopBottomOffsetForScrollingSibling();
   if (currentOffset == offset) {
       if (mAnimator != null && mAnimator.isRunning()) {
           mAnimator.cancel();
       }
       return;
   }
   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();
   }
   // Set the duration based on the amount of dips we're travelling in
   final float distanceDp = Math.abs(currentOffset - offset) /
        coordinatorLayout.getResources().getDisplayMetrics().density;
   mAnimator.setDuration(Math.round(distanceDp * 1000 / ANIMATE_OFFSET_DIPS_PER_SECOND));
   mAnimator.setIntValues(currentOffset, offset);
   mAnimator.start();
}

Как изменить анимацию расширения / сжатия и сделать ее быстрее?

Ответы на вопрос(1)

Ваш ответ на вопрос