Esempio n. 1
0
 public void cancel() {
   // Only cancel if the animation is actually running or has been started and is about
   // to run
   if (mPlayingState != STOPPED
       || sPendingAnimations.get().contains(this)
       || sDelayedAnims.get().contains(this)) {
     // Only notify listeners if the animator has actually started
     if (mRunning && mListeners != null) {
       ArrayList<AnimatorListener> tmpListeners = (ArrayList<AnimatorListener>) mListeners.clone();
       for (AnimatorListener listener : tmpListeners) {
         listener.onAnimationCancel(this);
       }
     }
     endAnimation();
   }
 }
Esempio n. 2
0
 public void end() {
   if (!sAnimations.get().contains(this) && !sPendingAnimations.get().contains(this)) {
     // Special case if the animation has not yet started; get it ready for ending
     mStartedDelay = false;
     startAnimation();
   } else if (!mInitialized) {
     initAnimation();
   }
   // The final value set on the target varies, depending on whether the animation
   // was supposed to repeat an odd number of times
   if (mRepeatCount > 0 && (mRepeatCount & 0x01) == 1) {
     animateValue(0f);
   } else {
     animateValue(1f);
   }
   endAnimation();
 }