public void onAnimationCancel(Animator animation) { if (!this.this$0.mTerminated && AnimatorSet.access$000(this.this$0).size() == 0 && this .this$0.mListeners != null) { int numListeners = this.this$0.mListeners.size(); for (int i = 0; i < numListeners; i++) { ((AnimatorListener) this.this$0.mListeners.get(i)).onAnimationCancel(this .mAnimatorSet); } } }
public void onAnimationEnd(Animator animation) { animation.removeListener(this); AnimatorSet.access$000(this.this$0).remove(animation); ((AnimatorSet$Node) AnimatorSet.access$100(this.mAnimatorSet).get(animation)).done = true; if (!this.this$0.mTerminated) { int i; ArrayList<AnimatorSet$Node> sortedNodes = AnimatorSet.access$200(this.mAnimatorSet); boolean allDone = true; int numSortedNodes = sortedNodes.size(); for (i = 0; i < numSortedNodes; i++) { if (!((AnimatorSet$Node) sortedNodes.get(i)).done) { allDone = false; break; } } if (allDone) { if (this.this$0.mListeners != null) { ArrayList<AnimatorListener> tmpListeners = (ArrayList) this.this$0.mListeners .clone(); int numListeners = tmpListeners.size(); for (i = 0; i < numListeners; i++) { ((AnimatorListener) tmpListeners.get(i)).onAnimationEnd(this.mAnimatorSet); } } AnimatorSet.access$302(this.mAnimatorSet, false); } } }
public void end() { this.mTerminated = true; if (isStarted()) { Iterator i$; if (this.mSortedNodes.size() != this.mNodes.size()) { sortNodes(); i$ = this.mSortedNodes.iterator(); while (i$.hasNext()) { Node node = (Node) i$.next(); if (this.mSetListener == null) { this.mSetListener = new AnimatorSetListener(this, this); } node.animation.addListener(this.mSetListener); } } if (this.mDelayAnim != null) { this.mDelayAnim.cancel(); } if (this.mSortedNodes.size() > 0) { i$ = this.mSortedNodes.iterator(); while (i$.hasNext()) { ((Node) i$.next()).animation.end(); } } if (this.mListeners != null) { i$ = ((ArrayList) this.mListeners.clone()).iterator(); while (i$.hasNext()) { ((AnimatorListener) i$.next()).onAnimationEnd(this); } } this.mStarted = false; } }
private void start(boolean playBackwards) { if (Looper.myLooper() == null) { throw new AndroidRuntimeException("Animators may only be run on Looper threads"); } this.mPlayingBackwards = playBackwards; this.mCurrentIteration = 0; this.mPlayingState = 0; this.mStarted = true; this.mStartedDelay = false; ((ArrayList) sPendingAnimations.get()).add(this); if (this.mStartDelay == 0) { setCurrentPlayTime(getCurrentPlayTime()); this.mPlayingState = 0; this.mRunning = true; if (this.mListeners != null) { ArrayList<AnimatorListener> tmpListeners = (ArrayList) this.mListeners.clone(); int numListeners = tmpListeners.size(); for (int i = 0; i < numListeners; i++) { ((AnimatorListener) tmpListeners.get(i)).onAnimationStart(this); } } } AnimationHandler animationHandler = (AnimationHandler) sAnimationHandler.get(); if (animationHandler == null) { animationHandler = new AnimationHandler(null); sAnimationHandler.set(animationHandler); } animationHandler.sendEmptyMessage(0); }
public void cancel() { if (this.mPlayingState != 0 || ((ArrayList) sPendingAnimations.get()).contains(this) || ( (ArrayList) sDelayedAnims.get()).contains(this)) { if (this.mRunning && this.mListeners != null) { Iterator i$ = ((ArrayList) this.mListeners.clone()).iterator(); while (i$.hasNext()) { ((AnimatorListener) i$.next()).onAnimationCancel(this); } } endAnimation(); } }
private void endAnimation() { ((ArrayList) sAnimations.get()).remove(this); ((ArrayList) sPendingAnimations.get()).remove(this); ((ArrayList) sDelayedAnims.get()).remove(this); this.mPlayingState = 0; if (this.mRunning && this.mListeners != null) { ArrayList<AnimatorListener> tmpListeners = (ArrayList) this.mListeners.clone(); int numListeners = tmpListeners.size(); for (int i = 0; i < numListeners; i++) { ((AnimatorListener) tmpListeners.get(i)).onAnimationEnd(this); } } this.mRunning = false; this.mStarted = false; }
private void startAnimation() { initAnimation(); ((ArrayList) sAnimations.get()).add(this); if (this.mStartDelay > 0 && this.mListeners != null) { ArrayList<AnimatorListener> tmpListeners = (ArrayList) this.mListeners.clone(); int numListeners = tmpListeners.size(); for (int i = 0; i < numListeners; i++) { ((AnimatorListener) tmpListeners.get(i)).onAnimationStart(this); } } }
public BaseViewAnimator addAnimatorListener(AnimatorListener l) { mAnimatorSet.addListener(l); return this; }
public void removeAnimatorListener(AnimatorListener l) { mAnimatorSet.removeListener(l); }
boolean animationFrame(long currentTime) { boolean done = false; if (this.mPlayingState == 0) { this.mPlayingState = 1; if (this.mSeekTime < 0) { this.mStartTime = currentTime; } else { this.mStartTime = currentTime - this.mSeekTime; this.mSeekTime = -1; } } switch (this.mPlayingState) { case 1: case 2: float fraction; if (this.mDuration > 0) { fraction = ((float) (currentTime - this.mStartTime)) / ((float) this.mDuration); } else { fraction = 1.0f; } if (fraction >= 1.0f) { if (this.mCurrentIteration < this.mRepeatCount || this.mRepeatCount == -1) { if (this.mListeners != null) { int numListeners = this.mListeners.size(); for (int i = 0; i < numListeners; i++) { ((AnimatorListener) this.mListeners.get(i)).onAnimationRepeat(this); } } if (this.mRepeatMode == 2) { this.mPlayingBackwards = !this.mPlayingBackwards; } this.mCurrentIteration += (int) fraction; fraction %= 1.0f; this.mStartTime += this.mDuration; } else { done = true; fraction = Math.min(fraction, 1.0f); } } if (this.mPlayingBackwards) { fraction = 1.0f - fraction; } animateValue(fraction); break; } return done; }
public ViewPropertyAnimator setListener(AnimatorListener listener) { this.mListener = listener; return this; }
/** * Animate. * * @param progressBar * the progress bar * @param listener * the listener */ private void animate(final HoloCircularProgressBar progressBar, final AnimatorListener listener) { final float progress = (float) (Math.random() * 2); int duration = 3000; animate(progressBar, listener, progress, duration); }
public abstract ViewPropertyAnimator setListener(AnimatorListener animatorListener);