List of usage examples for android.animation Animator removeListener
public void removeListener(AnimatorListener listener)
From source file:com.gigamole.library.ntb.NavigationTabBar.java
public void setOnTabBarSelectedIndexListener( final OnTabBarSelectedIndexListener onTabBarSelectedIndexListener) { mOnTabBarSelectedIndexListener = onTabBarSelectedIndexListener; if (mAnimatorListener == null) mAnimatorListener = new Animator.AnimatorListener() { @Override//from w ww . j a va2 s .c o m public void onAnimationStart(final Animator animation) { if (mOnTabBarSelectedIndexListener != null) mOnTabBarSelectedIndexListener.onStartTabSelected(mModels.get(mIndex), mIndex); animation.removeListener(this); animation.addListener(this); } @Override public void onAnimationEnd(final Animator animation) { if (mIsViewPagerMode) return; animation.removeListener(this); animation.addListener(this); if (mOnTabBarSelectedIndexListener != null) mOnTabBarSelectedIndexListener.onEndTabSelected(mModels.get(mIndex), mIndex); } @Override public void onAnimationCancel(final Animator animation) { } @Override public void onAnimationRepeat(final Animator animation) { } }; mAnimator.removeListener(mAnimatorListener); mAnimator.addListener(mAnimatorListener); }
From source file:cn.oddcloud.www.navigationtabbar.ntb.NavigationTabBar.java
public void setOnTabBarSelectedIndexListener( final OnTabBarSelectedIndexListener onTabBarSelectedIndexListener) { mOnTabBarSelectedIndexListener = onTabBarSelectedIndexListener; if (mAnimatorListener == null) mAnimatorListener = new AnimatorListenerAdapter() { @Override/* w w w . j a va 2 s . c om*/ public void onAnimationStart(final Animator animation) { if (mOnTabBarSelectedIndexListener != null) mOnTabBarSelectedIndexListener.onStartTabSelected(mModels.get(mIndex), mIndex); animation.removeListener(this); animation.addListener(this); } @Override public void onAnimationEnd(final Animator animation) { if (mIsViewPagerMode) return; animation.removeListener(this); animation.addListener(this); if (mOnTabBarSelectedIndexListener != null) mOnTabBarSelectedIndexListener.onEndTabSelected(mModels.get(mIndex), mIndex); } }; mAnimator.removeListener(mAnimatorListener); mAnimator.addListener(mAnimatorListener); }
From source file:android.transitions.everywhere.Transition.java
/** * This is a utility method used by subclasses to handle standard parts of * setting up and running an Animator: it sets the {@link #getDuration() * duration} and the {@link #getStartDelay() startDelay}, starts the * animation, and, when the animator ends, calls {@link #end()}. * * @param animator The Animator to be run during this transition. * @hide/*from w w w.ja v a2s. c om*/ */ protected void animate(Animator animator) { // TODO: maybe pass auto-end as a boolean parameter? if (animator == null) { end(); } else { if (getDuration() >= 0) { animator.setDuration(getDuration()); } if (getStartDelay() >= 0) { animator.setStartDelay(getStartDelay() + animator.getStartDelay()); } if (getInterpolator() != null) { animator.setInterpolator(getInterpolator()); } animator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { end(); animation.removeListener(this); } }); animator.start(); } }