PhoneTabSwitcherLayout.java 文件源码

java
阅读 36 收藏 0 点赞 0 评论 0

项目:ChromeLikeTabSwitcher 作者:
/**
 * Creates and returns an animation listener, which allows to zoom in the currently selected
 * tab, when a peek animation has been ended.
 *
 * @param selectedItem
 *         The item, which corresponds to the currently selected tab, as an instance of the
 *         class {@link AbstractItem}. The item may not be null
 * @param peekAnimation
 *         The peek animation as an instance of the class {@link PeekAnimation}. The peek
 *         animation may not be null
 * @return The listener, which has been created, as an instance of the type {@link
 * AnimatorListener}. The listener may not be null
 */
@NonNull
private AnimatorListener createZoomOutAnimationListener(
        @NonNull final AbstractItem selectedItem, @NonNull final PeekAnimation peekAnimation) {
    return new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(final Animator animation) {
            super.onAnimationEnd(animation);
            getModel().removeListener(PhoneTabSwitcherLayout.this);
            getModel().hideSwitcher();
            long totalDuration =
                    peekAnimation.getDuration() != -1 ? peekAnimation.getDuration() :
                            peekAnimationDuration;
            long duration = totalDuration / 3;
            Interpolator interpolator =
                    peekAnimation.getInterpolator() != null ? peekAnimation.getInterpolator() :
                            new AccelerateDecelerateInterpolator();
            animateHideSwitcher(selectedItem, duration, interpolator, duration,
                    createZoomInAnimationListener(selectedItem));
        }

    };
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号