Search in sources :

Example 6 with BaseItemAnimator

use of com.dk.animation.effect.BaseItemAnimator 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

Animator (android.animation.Animator)6 AnimatorListener (android.animation.Animator.AnimatorListener)6 ObjectAnimator (android.animation.ObjectAnimator)6 BaseItemAnimator (com.dk.animation.effect.BaseItemAnimator)6 SegmentAnimator (com.dk.animation.effect.SegmentAnimator)6 AnimatorSet (android.animation.AnimatorSet)5 View (android.view.View)1