List of usage examples for android.animation AnimatorSet removeAllListeners
public void removeAllListeners()
From source file:com.gudong.appkit.ui.helper.AppItemAnimator.java
private void animateAddImpl(final RecyclerView.ViewHolder viewHolder) { final View target = viewHolder.itemView; mAddAnimations.add(viewHolder);/* w w w.ja v a 2 s. c o m*/ final AnimatorSet animator = new AnimatorSet(); animator.playTogether(ObjectAnimator.ofFloat(target, "translationX", -target.getMeasuredWidth(), 0, 0f), ObjectAnimator.ofFloat(target, "alpha", 0.5f, 1.0f)); animator.setTarget(target); animator.setDuration(KEY_DURATION_TIME); animator.setInterpolator(new AccelerateInterpolator()); animator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationStart(Animator animation) { super.onAnimationStart(animation); dispatchAddStarting(viewHolder); } @Override public void onAnimationCancel(Animator animation) { super.onAnimationCancel(animation); ViewCompat.setAlpha(target, 1); } @Override public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); animator.removeAllListeners(); dispatchAddFinished(viewHolder); mAddAnimations.remove(viewHolder); dispatchFinishedWhenDone(); } }); animator.start(); }