@Override public Node clone() { try { Node node = (Node) super.clone(); node.animation = animation.clone(); return node; } catch (CloneNotSupportedException e) { throw new AssertionError(); } } }
private void finishAnimation() { final Animator a = mCurrentAnimation; if (a != null) { mCurrentAnimation = null; a.end(); } }
/** * Returns whether this Animator has been started and not yet ended. This state is a superset * of the state of {@link #isRunning()}, because an Animator with a nonzero * {@link #getStartDelay() startDelay} will return true for {@link #isStarted()} during the * delay phase, whereas {@link #isRunning()} will return true only after the delay phase * is complete. * * @return Whether the Animator has been started and not yet ended. */ public boolean isStarted() { // Default method returns value for isRunning(). Subclasses should override to return a // real value. return isRunning(); }
Node node = mSortedNodes.get(i); ArrayList<AnimatorListener> oldListeners = node.animation.getListeners(); if (oldListeners != null && oldListeners.size() > 0) { final ArrayList<AnimatorListener> clonedListeners = new if (listener instanceof DependencyListener || listener instanceof AnimatorSetListener) { node.animation.removeListener(listener); for (int j = 0; j < numDependencies; ++j) { Dependency dependency = node.dependencies.get(j); dependency.node.animation.addListener( new DependencyListener(this, node, dependency.rule)); node.animation.addListener(mSetListener); node.animation.start(); mPlayingSet.add(node.animation);
dependencyAnimation.removeListener(this); break; if (mNode.tmpDependencies.size() == 0) { mNode.animation.start(); mAnimatorSet.mPlayingSet.add(mNode.animation);
mSetListener = new AnimatorSetListener(this); node.animation.addListener(mSetListener); node.animation.end();
@Override public AnimatorSet clone() { final AnimatorSet anim = (AnimatorSet) super.clone(); ArrayList<AnimatorListener> cloneListeners = nodeClone.animation.getListeners(); if (cloneListeners != null) { ArrayList<AnimatorListener> listenersToRemove = null;
} else if (mSortedNodes.size() > 0) { for (Node node : mSortedNodes) { node.animation.cancel();
@Override public void setupEndValues() { for (Node node : mNodes) { node.animation.setupEndValues(); } }
/** * Sets the TimeInterpolator for all current {@link #getChildAnimations() child animations} * of this AnimatorSet. * * @param interpolator the interpolator to be used by each child animation of this AnimatorSet */ @Override public void setInterpolator(/*Time*/Interpolator interpolator) { for (Node node : mNodes) { node.animation.setInterpolator(interpolator); } }
/** * Sets the length of each of the current child animations of this AnimatorSet. By default, * each child animation will use its own duration. If the duration is set on the AnimatorSet, * then each child animation inherits this duration. * * @param duration The length of the animation, in milliseconds, of each of the child * animations of this AnimatorSet. */ @Override public AnimatorSet setDuration(long duration) { if (duration < 0) { throw new IllegalArgumentException("duration must be a value of zero or greater"); } for (Node node : mNodes) { // TODO: don't set the duration of the timing-only nodes created by AnimatorSet to // insert "play-after" delays node.animation.setDuration(duration); } mDuration = duration; return this; }
public void onAnimationEnd(Animator animation) { animation.removeListener(this); mPlayingSet.remove(animation); Node animNode = mAnimatorSet.mNodeMap.get(animation);
Node node = mSortedNodes.get(i); ArrayList<AnimatorListener> oldListeners = node.animation.getListeners(); if (oldListeners != null && oldListeners.size() > 0) { final ArrayList<AnimatorListener> clonedListeners = new if (listener instanceof DependencyListener || listener instanceof AnimatorSetListener) { node.animation.removeListener(listener); for (int j = 0; j < numDependencies; ++j) { Dependency dependency = node.dependencies.get(j); dependency.node.animation.addListener( new DependencyListener(this, node, dependency.rule)); node.animation.addListener(mSetListener); node.animation.start(); mPlayingSet.add(node.animation);
dependencyAnimation.removeListener(this); break; if (mNode.tmpDependencies.size() == 0) { mNode.animation.start(); mAnimatorSet.mPlayingSet.add(mNode.animation);
mSetListener = new AnimatorSetListener(this); node.animation.addListener(mSetListener); node.animation.end();
@Override public AnimatorSet clone() { final AnimatorSet anim = (AnimatorSet) super.clone(); ArrayList<AnimatorListener> cloneListeners = nodeClone.animation.getListeners(); if (cloneListeners != null) { ArrayList<AnimatorListener> listenersToRemove = null;
} else if (mSortedNodes.size() > 0) { for (Node node : mSortedNodes) { node.animation.cancel();
@Override public void setupEndValues() { for (Node node : mNodes) { node.animation.setupEndValues(); } }
/** * Sets the TimeInterpolator for all current {@link #getChildAnimations() child animations} * of this AnimatorSet. * * @param interpolator the interpolator to be used by each child animation of this AnimatorSet */ @Override public void setInterpolator(/*Time*/Interpolator interpolator) { for (Node node : mNodes) { node.animation.setInterpolator(interpolator); } }
/** * Sets the length of each of the current child animations of this AnimatorSet. By default, * each child animation will use its own duration. If the duration is set on the AnimatorSet, * then each child animation inherits this duration. * * @param duration The length of the animation, in milliseconds, of each of the child * animations of this AnimatorSet. */ @Override public AnimatorSet setDuration(long duration) { if (duration < 0) { throw new IllegalArgumentException("duration must be a value of zero or greater"); } for (Node node : mNodes) { // TODO: don't set the duration of the timing-only nodes created by AnimatorSet to // insert "play-after" delays node.animation.setDuration(duration); } mDuration = duration; return this; }