예제 #1
0
 /**
  * {@inheritDoc}
  *
  * <p>Note that canceling a <code>AnimatorSet</code> also cancels all of the animations that it is
  * responsible for.
  */
 @SuppressWarnings("unchecked")
 @Override
 public void cancel() {
   mTerminated = true;
   if (isStarted()) {
     ArrayList<AnimatorListener> tmpListeners = null;
     if (mListeners != null) {
       tmpListeners = (ArrayList<AnimatorListener>) mListeners.clone();
       for (AnimatorListener listener : tmpListeners) {
         listener.onAnimationCancel(this);
       }
     }
     if (mDelayAnim != null && mDelayAnim.isRunning()) {
       // If we're currently in the startDelay period, just cancel that animator and
       // send out the end event to all listeners
       mDelayAnim.cancel();
     } else if (mSortedNodes.size() > 0) {
       for (Node node : mSortedNodes) {
         node.animation.cancel();
       }
     }
     if (tmpListeners != null) {
       for (AnimatorListener listener : tmpListeners) {
         listener.onAnimationEnd(this);
       }
     }
     mStarted = false;
   }
 }