CardGroup.java 文件源码

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

项目:CardsView 作者:
/**
 * 重置下面的卡片
 * @param position
 */
private void makeUnderViewReset(int position) {
    CardView underSlideView = slideViewMap.get(position);

    if (underSlideView != null) {
        int topMargin = (int) underSlideView.getTag(R.id.card_margin_top);
        float scale = (float) underSlideView.getTag(R.id.card_scale);
        int topPadding = underSlideView.getPaddingTop();
        float curScale = underSlideView.getScaleX();

        ValueAnimator paddingAnimator = ValueAnimator.ofInt(topPadding, topMargin);
        paddingAnimator.setTarget(underSlideView);
        paddingAnimator.setDuration(ANIM_DURATION);
        paddingAnimator.setInterpolator(new AnticipateOvershootInterpolator());
        paddingAnimator.addUpdateListener((animation) -> {
            int padding = (int) animation.getAnimatedValue();
            underSlideView.setPadding(0, padding, 0, 0);
        });

        ValueAnimator scaleAnimator = ValueAnimator.ofFloat(curScale, scale);
        scaleAnimator.setTarget(underSlideView);
        scaleAnimator.setDuration(ANIM_DURATION);
        scaleAnimator.setInterpolator(new AnticipateOvershootInterpolator());
        scaleAnimator.addUpdateListener(animation -> {
            float valueScale = (float) animation.getAnimatedValue();
            underSlideView.setScaleX(valueScale);
        });

        paddingAnimator.start();
        scaleAnimator.start();
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号