List of usage examples for android.animation ObjectAnimator cancel
@Override public void cancel()
From source file:Main.java
private static void setupChangeAnimationOneTime(final View view) { ObjectAnimator objectAnimator = sMapAnimators.get(view); if (objectAnimator != null) { objectAnimator.cancel(); sMapAnimators.remove(objectAnimator); }//from w w w .j a v a 2s . c o m OnLayoutChangeListener listener = sMapListeners.get(view); if (listener != null) { view.removeOnLayoutChangeListener(listener); sMapListeners.remove(view); } final OnLayoutChangeListener onLayoutChangeListener = new OnLayoutChangeListener() { @Override public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) { ObjectAnimator objectAnimator = sMapAnimators.get(view); if (objectAnimator != null) { objectAnimator.cancel(); sMapAnimators.remove(objectAnimator); } final ObjectAnimator changeAnimator = getChangeAnimator(v, left, top, right, bottom, oldLeft, oldTop, oldRight, oldBottom); sMapAnimators.put(view, changeAnimator); if (left != oldLeft || top != oldTop || right != oldRight || bottom != oldBottom) { Animator.AnimatorListener animatorListener = new Animator.AnimatorListener() { @Override public void onAnimationStart(Animator animation) { if (sAnimatorListener != null) { sAnimatorListener.onAnimationStart(animation); } } @Override public void onAnimationRepeat(Animator animation) { if (sAnimatorListener != null) { sAnimatorListener.onAnimationRepeat(animation); } } @Override public void onAnimationEnd(Animator animation) { sMapAnimators.remove(view); if (sAnimatorListener != null) { sAnimatorListener.onAnimationEnd(animation); } } @Override public void onAnimationCancel(Animator animation) { if (sAnimatorListener != null) { sAnimatorListener.onAnimationCancel(animation); } } }; changeAnimator.addListener(animatorListener); changeAnimator.start(); } else { sMapAnimators.remove(view); if (sAnimatorListener != null) { sAnimatorListener.onAnimationEnd(changeAnimator); } } } }; view.addOnLayoutChangeListener(onLayoutChangeListener); sMapListeners.put(view, onLayoutChangeListener); }
From source file:com.arlib.floatingsearchview.util.view.MenuView.java
private void cancelChildAnimListAndClear() { for (ObjectAnimator animator : anims) animator.cancel(); anims.clear(); }