Search in sources :

Example 31 with AnimatorListener

use of android.animation.Animator.AnimatorListener in project RecyclerViewAnimator by dkmeteor.

the class FlipVertialIn method startAnimation.

@Override
public void startAnimation(final ViewHolder holder, long duration, final BaseItemAnimator animator) {
    ViewCompat.animate(holder.itemView).cancel();
    AnimatorSet set = new AnimatorSet();
    set.playTogether(ObjectAnimator.ofFloat(holder.itemView, "rotationX", 90, -15, 15, 0), ObjectAnimator.ofFloat(holder.itemView, "alpha", 0.25f, 0.5f, 0.75f, 1));
    set.addListener(new AnimatorListener() {

        @Override
        public void onAnimationStart(Animator animation) {
        // TODO Auto-generated method stub
        }

        @Override
        public void onAnimationRepeat(Animator animation) {
        // TODO Auto-generated method stub
        }

        @Override
        public void onAnimationEnd(Animator animation) {
            animator.dispatchAddFinished(holder);
            animator.mAddAnimations.remove(holder);
            animator.dispatchFinishedWhenDone();
        }

        @Override
        public void onAnimationCancel(Animator animation) {
        // TODO Auto-generated method stub
        }
    });
    set.setStartDelay(mDelay * mDelayCount);
    set.setDuration(animator.getAddDuration());
    set.start();
    animator.mAddAnimations.add(holder);
}
Also used : AnimatorListener(android.animation.Animator.AnimatorListener) BaseItemAnimator(com.dk.animation.effect.BaseItemAnimator) ObjectAnimator(android.animation.ObjectAnimator) SegmentAnimator(com.dk.animation.effect.SegmentAnimator) Animator(android.animation.Animator) AnimatorSet(android.animation.AnimatorSet)

Example 32 with AnimatorListener

use of android.animation.Animator.AnimatorListener in project RecyclerViewAnimator by dkmeteor.

the class ShakeIn method startAnimation.

@Override
public void startAnimation(final ViewHolder holder, long duration, final BaseItemAnimator animator) {
    ViewCompat.animate(holder.itemView).cancel();
    ObjectAnimator objectAnimatorAnimator = ObjectAnimator.ofFloat(holder.itemView, "translationX", -ViewUtils.getScreenWidth(), -ViewUtils.getScreenWidth() * 3f / 4f, -ViewUtils.getScreenWidth() / 2f, -ViewUtils.getScreenWidth() / 4f, 0, 25, -25, 25, -25, 15, -15, 6, -6, 0);
    objectAnimatorAnimator.addListener(new AnimatorListener() {

        @Override
        public void onAnimationStart(Animator animation) {
        }

        @Override
        public void onAnimationRepeat(Animator animation) {
        }

        @Override
        public void onAnimationEnd(Animator animation) {
            animator.dispatchAddFinished(holder);
            animator.mAddAnimations.remove(holder);
            animator.dispatchFinishedWhenDone();
        }

        @Override
        public void onAnimationCancel(Animator animation) {
        }
    });
    objectAnimatorAnimator.setStartDelay(mDelay * mDelayCount);
    objectAnimatorAnimator.setDuration(animator.getAddDuration());
    objectAnimatorAnimator.start();
    animator.mAddAnimations.add(holder);
}
Also used : AnimatorListener(android.animation.Animator.AnimatorListener) BaseItemAnimator(com.dk.animation.effect.BaseItemAnimator) ObjectAnimator(android.animation.ObjectAnimator) SegmentAnimator(com.dk.animation.effect.SegmentAnimator) Animator(android.animation.Animator) ObjectAnimator(android.animation.ObjectAnimator)

Aggregations

AnimatorListener (android.animation.Animator.AnimatorListener)32 ObjectAnimator (android.animation.ObjectAnimator)25 Animator (android.animation.Animator)24 AnimatorSet (android.animation.AnimatorSet)10 ValueAnimator (android.animation.ValueAnimator)8 View (android.view.View)8 ImageView (android.widget.ImageView)6 TextView (android.widget.TextView)6 BaseItemAnimator (com.dk.animation.effect.BaseItemAnimator)6 SegmentAnimator (com.dk.animation.effect.SegmentAnimator)6 AnimatorUpdateListener (android.animation.ValueAnimator.AnimatorUpdateListener)5 Intent (android.content.Intent)5 ArrayList (java.util.ArrayList)4 PropertyValuesHolder (android.animation.PropertyValuesHolder)3 TimeInterpolator (android.animation.TimeInterpolator)3 ArgbEvaluator (android.animation.ArgbEvaluator)2 DecelerateInterpolator (android.view.animation.DecelerateInterpolator)2 Comparator (java.util.Comparator)2 SuppressLint (android.annotation.SuppressLint)1 Paint (android.graphics.Paint)1