java类android.view.animation.Animation.AnimationListener的实例源码

SuperSwipeRefreshLayout.java 文件源码 项目:decoy 阅读 44 收藏 0 点赞 0 评论 0
private void animateOffsetToStartPosition(int from,
                                          AnimationListener listener) {
    if (mScale) {
        startScaleDownReturnToStartAnimation(from, listener);
    } else {
        mFrom = from;
        mAnimateToStartPosition.reset();
        mAnimateToStartPosition.setDuration(ANIMATE_TO_START_DURATION);
        mAnimateToStartPosition.setInterpolator(mDecelerateInterpolator);
        if (listener != null) {
            mHeadViewContainer.setAnimationListener(listener);
        }
        mHeadViewContainer.clearAnimation();
        mHeadViewContainer.startAnimation(mAnimateToStartPosition);
    }
    resetTargetLayoutDelay(ANIMATE_TO_START_DURATION);
}
SuperSwipeRefreshLayout.java 文件源码 项目:decoy 阅读 25 收藏 0 点赞 0 评论 0
private void startScaleDownReturnToStartAnimation(int from,
                                                  Animation.AnimationListener listener) {
    mFrom = from;
    mStartingScale = ViewCompat.getScaleX(mHeadViewContainer);
    mScaleDownToStartAnimation = new Animation() {
        @Override
        public void applyTransformation(float interpolatedTime,
                                        Transformation t) {
            float targetScale = (mStartingScale + (-mStartingScale * interpolatedTime));
            setAnimationProgress(targetScale);
            moveToStart(interpolatedTime);
        }
    };
    mScaleDownToStartAnimation.setDuration(SCALE_DOWN_DURATION);
    if (listener != null) {
        mHeadViewContainer.setAnimationListener(listener);
    }
    mHeadViewContainer.clearAnimation();
    mHeadViewContainer.startAnimation(mScaleDownToStartAnimation);
}
SwipeRefreshLayout.java 文件源码 项目:android-source-codes 阅读 40 收藏 0 点赞 0 评论 0
private void startScaleUpAnimation(AnimationListener listener) {
    mCircleView.setVisibility(View.VISIBLE);
    if (android.os.Build.VERSION.SDK_INT >= 11) {
        // Pre API 11, alpha is used in place of scale up to show the
        // progress circle appearing.
        // Don't adjust the alpha during appearance otherwise.
        mProgress.setAlpha(MAX_ALPHA);
    }
    mScaleAnimation = new Animation() {
        @Override
        public void applyTransformation(float interpolatedTime, Transformation t) {
            setAnimationProgress(interpolatedTime);
        }
    };
    mScaleAnimation.setDuration(mMediumAnimationDuration);
    if (listener != null) {
        mCircleView.setAnimationListener(listener);
    }
    mCircleView.clearAnimation();
    mCircleView.startAnimation(mScaleAnimation);
}
SwipeRefreshLayout.java 文件源码 项目:GitHub 阅读 33 收藏 0 点赞 0 评论 0
private void animateOffsetToCorrectPosition(int from, AnimationListener listener) {
    mFrom = from;
    mAnimateToCorrectPosition.reset();
    mAnimateToCorrectPosition.setDuration(ANIMATE_TO_TRIGGER_DURATION);
    mAnimateToCorrectPosition.setInterpolator(mDecelerateInterpolator);
    if (listener != null) {
        mCircleView.setAnimationListener(listener);
    }
    mCircleView.clearAnimation();
    mCircleView.startAnimation(mAnimateToCorrectPosition);
}
WelcomeSnowActy.java 文件源码 项目:QMark 阅读 30 收藏 0 点赞 0 评论 0
private Animation createAnimation(int top, AnimationListener l) {
    AnimationSet set = new AnimationSet(false);
    set.addAnimation(startAlpha());
    set.addAnimation(startScale());
    int duration = (int) (Math.random() * 10000 + 3000);
    set.addAnimation(randomRotate(duration));
    set.addAnimation(randomScale());
    set.addAnimation(endScale(duration));
    //添加的顺序很重要,TranslateAnimation必须在ScaleAnimation的后面,否则会出现奇怪的现象
    set.addAnimation(randomTranslate(top, duration, l));
    set.addAnimation(randomTranslateX());
    set.addAnimation(endAlpha(duration));
    return set;
}
WelcomeSnowActy.java 文件源码 项目:QMark 阅读 29 收藏 0 点赞 0 评论 0
private TranslateAnimation randomTranslate(int startTopInParent, int duration, AnimationListener l) {
    float halfPercent = (1 + startTopInParent * 1.0f / mScreenHeight) / 2;
    TranslateAnimation trans = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, (float) ((Math.random() > 0.5f ? 1 : -1) * Math.random()) * 5,
            Animation.RELATIVE_TO_PARENT, 0, Animation.RELATIVE_TO_PARENT, (float) (Math.random() * halfPercent + halfPercent));
    trans.setInterpolator(this, android.R.anim.linear_interpolator);
    trans.setStartOffset(0);
    trans.setDuration(duration);
    trans.setAnimationListener(l);
    return trans;
}
SuperSwipeRefreshLayout.java 文件源码 项目:Amazing 阅读 25 收藏 0 点赞 0 评论 0
private void startScaleDownAnimation(AnimationListener listener) {
    mScaleDownAnimation = new Animation() {
        @Override
        public void applyTransformation(float interpolatedTime,
                                        Transformation t) {
            setAnimationProgress(1 - interpolatedTime);
        }
    };
    mScaleDownAnimation.setDuration(SCALE_DOWN_DURATION);
    mHeadViewContainer.setAnimationListener(listener);
    mHeadViewContainer.clearAnimation();
    mHeadViewContainer.startAnimation(mScaleDownAnimation);
}
SuperSwipeRefreshLayout.java 文件源码 项目:Amazing 阅读 34 收藏 0 点赞 0 评论 0
private void animateOffsetToCorrectPosition(int from,
                                            AnimationListener listener) {
    mFrom = from;
    mAnimateToCorrectPosition.reset();
    mAnimateToCorrectPosition.setDuration(ANIMATE_TO_TRIGGER_DURATION);
    mAnimateToCorrectPosition.setInterpolator(mDecelerateInterpolator);
    if (listener != null) {
        mHeadViewContainer.setAnimationListener(listener);
    }
    mHeadViewContainer.clearAnimation();
    mHeadViewContainer.startAnimation(mAnimateToCorrectPosition);
}
SuperSwipeRefreshLayout.java 文件源码 项目:Amazing 阅读 40 收藏 0 点赞 0 评论 0
private void animateOffsetToStartPosition(int from,
                                          AnimationListener listener) {
    mFrom = from;
    mAnimateToStartPosition.reset();
    mAnimateToStartPosition.setDuration(ANIMATE_TO_START_DURATION);
    mAnimateToStartPosition.setInterpolator(mDecelerateInterpolator);
    if (listener != null) {
        mHeadViewContainer.setAnimationListener(listener);
    }
    mHeadViewContainer.clearAnimation();
    mHeadViewContainer.startAnimation(mAnimateToStartPosition);
    resetTargetLayoutDelay(ANIMATE_TO_START_DURATION);
}
SuperSwipeRefreshLayout.java 文件源码 项目:LuaViewPlayground 阅读 22 收藏 0 点赞 0 评论 0
private void startScaleUpAnimation(AnimationListener listener) {
    mScaleAnimation = new Animation() {
        @Override
        public void applyTransformation(float interpolatedTime,
                                        Transformation t) {
            setAnimationProgress(interpolatedTime);
        }
    };
    mScaleAnimation.setDuration(mMediumAnimationDuration);
    if (listener != null) {
        mHeadViewContainer.setAnimationListener(listener);
    }
    mHeadViewContainer.clearAnimation();
    mHeadViewContainer.startAnimation(mScaleAnimation);
}


问题


面经


文章

微信
公众号

扫码关注公众号