Build 1.0_r1(from source)

android.view.animation
Class AnimationSet

java.lang.Object
  extended by android.view.animation.Animation
      extended by android.view.animation.AnimationSet

public class AnimationSet
extends Animation

Represents a group of Animations that should be played together. The transformation of each individual animation are composed together into a single transform. If AnimationSet sets any properties that its children also set (for example, duration or fillBefore), the values of AnimationSet override the child values.


Nested Class Summary
 
Nested classes/interfaces inherited from class android.view.animation.Animation
Animation.AnimationListener, Animation.Description
 
Field Summary
 
Fields inherited from class android.view.animation.Animation
ABSOLUTE, INFINITE, mCycleFlip, mDuration, mEnded, mFillAfter, mFillBefore, mInitialized, mInterpolator, mListener, mRepeatCount, mRepeated, mRepeatMode, mStarted, mStartOffset, mStartTime, RELATIVE_TO_PARENT, RELATIVE_TO_SELF, RESTART, REVERSE, START_ON_FIRST_FRAME, ZORDER_BOTTOM, ZORDER_NORMAL, ZORDER_TOP
 
Constructor Summary
AnimationSet(boolean shareInterpolator)
          Constructor to use when building an AnimationSet from code
AnimationSet(Context context, AttributeSet attrs)
          Constructor used whan an AnimationSet is loaded from a resource.
 
Method Summary
 void addAnimation(Animation a)
          Add a child animation to this animation set.
 List<Animation> getAnimations()
           
 long getDuration()
          The duration of an AnimationSet is defined to be the duration of the longest child animation.
 long getStartTime()
          When this animation should start.
 boolean getTransformation(long currentTime, Transformation t)
          The transformation of an animation set is the concatenation of all of its component animations.
 void initialize(int width, int height, int parentWidth, int parentHeight)
          Initialize this animation with the dimensions of the object being animated as well as the objects parents.
(package private)  void restoreChildrenStartOffset()
           
 void restrictDuration(long durationMillis)
          Ensure that the duration that this animation will run is not longer than durationMillis.
(package private)  void saveChildrenStartOffset(long startOffset)
           
 void scaleCurrentDuration(float scale)
          How much to scale the duration by.
 void setDuration(long durationMillis)
          Sets the duration of every child animation.
 void setFillAfter(boolean fillAfter)
          If fillAfter is true, the transformation that this animation performed will persist when it is finished.
 void setFillBefore(boolean fillBefore)
          If fillBefore is true, this animation will apply its transformation before the start time of the animation.
 void setRepeatMode(int repeatMode)
          Defines what this animation should do when it reaches the end.
 void setStartOffset(long startOffset)
          When this animation should start relative to the start time.
 void setStartTime(long startTimeMillis)
          Sets the start time of this animation and all child animations
 boolean willChangeTransformationMatrix()
          Indicates whether or not this animation will affect the transformation matrix.
 
Methods inherited from class android.view.animation.Animation
applyTransformation, ensureInterpolator, getFillAfter, getFillBefore, getInterpolator, getRepeatCount, getRepeatMode, getStartOffset, getZAdjustment, hasEnded, hasStarted, isInitialized, reset, resolveSize, setAnimationListener, setInterpolator, setInterpolator, setRepeatCount, setZAdjustment, start, startNow, willChangeBounds
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AnimationSet

public AnimationSet(Context context,
                    AttributeSet attrs)
Constructor used whan an AnimationSet is loaded from a resource.

Parameters:
context - Application context to use
attrs - Attribute set from which to read values

AnimationSet

public AnimationSet(boolean shareInterpolator)
Constructor to use when building an AnimationSet from code

Parameters:
shareInterpolator - Pass true if all of the animations in this set should use the interpolator assocciated with this AnimationSet. Pass false if each animation should use its own interpolator.
Method Detail

setFillAfter

public void setFillAfter(boolean fillAfter)
Description copied from class: Animation
If fillAfter is true, the transformation that this animation performed will persist when it is finished. Defaults to false if not set. Note that this applies when using an AnimationSet to chain animations. The transformation is not applied before the AnimationSet itself starts.

Overrides:
setFillAfter in class Animation
Parameters:
fillAfter - true if the animation should apply its transformation after it ends

setFillBefore

public void setFillBefore(boolean fillBefore)
Description copied from class: Animation
If fillBefore is true, this animation will apply its transformation before the start time of the animation. Defaults to false if not set. Note that this applies when using an AnimationSet to chain animations. The transformation is not applied before the AnimationSet itself starts.

Overrides:
setFillBefore in class Animation
Parameters:
fillBefore - true if the animation should apply its transformation before it starts

setRepeatMode

public void setRepeatMode(int repeatMode)
Description copied from class: Animation
Defines what this animation should do when it reaches the end. This setting is applied only when the repeat count is either greater than 0 or Animation.INFINITE. Defaults to Animation.RESTART.

Overrides:
setRepeatMode in class Animation
Parameters:
repeatMode - Animation.RESTART or Animation.REVERSE

setStartOffset

public void setStartOffset(long startOffset)
Description copied from class: Animation
When this animation should start relative to the start time. This is most useful when composing complex animations using an AnimationSet where some of the animations components start at different times.

Overrides:
setStartOffset in class Animation
Parameters:
startOffset - When this Animation should start, in milliseconds from the start time of the root AnimationSet.

setDuration

public void setDuration(long durationMillis)

Sets the duration of every child animation.

Overrides:
setDuration in class Animation
Parameters:
durationMillis - the duration of the animation, in milliseconds, for every child in this set

addAnimation

public void addAnimation(Animation a)
Add a child animation to this animation set. The transforms of the child animations are applied in the order that they were added

Parameters:
a - Animation to add.

setStartTime

public void setStartTime(long startTimeMillis)
Sets the start time of this animation and all child animations

Overrides:
setStartTime in class Animation
Parameters:
startTimeMillis - the start time in milliseconds
See Also:
Animation.setStartTime(long)

getStartTime

public long getStartTime()
Description copied from class: Animation
When this animation should start. If the animation has not startet yet, this method might return Animation.START_ON_FIRST_FRAME.

Overrides:
getStartTime in class Animation
Returns:
the time in milliseconds when the animation should start or Animation.START_ON_FIRST_FRAME

restrictDuration

public void restrictDuration(long durationMillis)
Description copied from class: Animation
Ensure that the duration that this animation will run is not longer than durationMillis. In addition to adjusting the duration itself, this ensures that the repeat count also will not make it run longer than the given time.

Overrides:
restrictDuration in class Animation
Parameters:
durationMillis - The maximum duration the animation is allowed to run.

getDuration

public long getDuration()
The duration of an AnimationSet is defined to be the duration of the longest child animation.

Overrides:
getDuration in class Animation
Returns:
the duration in milliseconds of the animation
See Also:
Animation.getDuration()

getTransformation

public boolean getTransformation(long currentTime,
                                 Transformation t)
The transformation of an animation set is the concatenation of all of its component animations.

Overrides:
getTransformation in class Animation
Parameters:
currentTime - Where we are in the animation. This is wall clock time.
t - A tranformation object that is provided by the caller and will be filled in by the animation.
Returns:
True if the animation is still running
See Also:
Animation.getTransformation(long, android.view.animation.Transformation)

scaleCurrentDuration

public void scaleCurrentDuration(float scale)
Description copied from class: Animation
How much to scale the duration by.

Overrides:
scaleCurrentDuration in class Animation
Parameters:
scale - The amount to scale the duration.
See Also:
Animation.scaleCurrentDuration(float)

initialize

public void initialize(int width,
                       int height,
                       int parentWidth,
                       int parentHeight)
Description copied from class: Animation
Initialize this animation with the dimensions of the object being animated as well as the objects parents. (This is to support animation sizes being specifed relative to these dimensions.)

Objects that interpret a Animations should call this method when the sizes of the object being animated and its parent are known, and before calling Animation.getTransformation(long, android.view.animation.Transformation).

Overrides:
initialize in class Animation
Parameters:
width - Width of the object being animated
height - Height of the object being animated
parentWidth - Width of the animated object's parent
parentHeight - Height of the animated object's parent
See Also:
Animation.initialize(int, int, int, int)

saveChildrenStartOffset

void saveChildrenStartOffset(long startOffset)
Parameters:
startOffset - the startOffset to add to the children's startOffset

restoreChildrenStartOffset

void restoreChildrenStartOffset()

getAnimations

public List<Animation> getAnimations()
Returns:
All the child animations in this AnimationSet. Note that this may include other AnimationSets, which are not expanded.

willChangeTransformationMatrix

public boolean willChangeTransformationMatrix()
Description copied from class: Animation

Indicates whether or not this animation will affect the transformation matrix. For instance, a fade animation will not affect the matrix whereas a scale animation will.

Overrides:
willChangeTransformationMatrix in class Animation
Returns:
true if this animation will change the transformation matrix

Build 1.0_r1(from source)

Please submit a feedback, bug or feature