|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectandroid.view.animation.LayoutAnimationController
public class LayoutAnimationController
A layout animation controller is used to animated a layout's, or a view
group's, children. Each child uses the same animation but for every one of
them, the animation starts at a different time. A layout animation controller
is used by ViewGroup to compute the delay by which each
child's animation start must be offset. The delay is computed by using
characteristics of each child, like its index in the view group.
This standard implementation computes the delay by multiplying a fixed
amount of miliseconds by the index of the child in its parent view group.
Subclasses are supposed to override
getDelayForView(android.view.View) to implement a different way
of computing the delay. For instance, a
GridLayoutAnimationController will compute the
delay based on the column and row indices of the child in its parent view
group.
Information used to compute the animation delay of each child are stored
in an instance of
LayoutAnimationController.AnimationParameters,
itself stored in the ViewGroup.LayoutParams of the view.
| Nested Class Summary | |
|---|---|
static class |
LayoutAnimationController.AnimationParameters
The set of parameters that has to be attached to each view contained in the view group animated by the layout animation controller. |
| Field Summary | |
|---|---|
protected Animation |
mAnimation
The animation applied on each child of the view group on which this layout animation controller is set. |
protected Interpolator |
mInterpolator
The interpolator used to interpolate the delays. |
protected Random |
mRandomizer
The randomizer used when the order is set to random. |
static int |
ORDER_NORMAL
Distributes the animation delays in the order in which view were added to their view group. |
static int |
ORDER_RANDOM
Randomly distributes the animation delays. |
static int |
ORDER_REVERSE
Distributes the animation delays in the reverse order in which view were added to their view group. |
| Constructor Summary | |
|---|---|
LayoutAnimationController(Animation animation)
Creates a new layout animation controller with a delay of 50% and the specified animation. |
|
LayoutAnimationController(Animation animation,
float delay)
Creates a new layout animation controller with the specified delay and the specified animation. |
|
LayoutAnimationController(Context context,
AttributeSet attrs)
Creates a new layout animation controller from external resources. |
|
| Method Summary | |
|---|---|
Animation |
getAnimation()
Returns the animation applied to each child of the view group on which this controller is set. |
Animation |
getAnimationForView(View view)
Returns the animation to be applied to the specified view. |
float |
getDelay()
Returns the delay by which the children's animation are offset. |
protected long |
getDelayForView(View view)
Returns the amount of milliseconds by which the specified view's animation must be delayed or offset. |
Interpolator |
getInterpolator()
Returns the interpolator used to interpolate the delays between the children. |
int |
getOrder()
Returns the order used to compute the delay of each child's animation. |
protected int |
getTransformedIndex(LayoutAnimationController.AnimationParameters params)
Transforms the index stored in LayoutAnimationController.AnimationParameters
by the order returned by getOrder(). |
boolean |
isDone()
Indicates whether the layout animation is over or not. |
void |
setAnimation(Animation animation)
Sets the animation to be run on each child of the view group on which this layout animation controller is . |
void |
setAnimation(Context context,
int resourceID)
Sets the animation to be run on each child of the view group on which this layout animation controller is . |
void |
setDelay(float delay)
Sets the delay, as a fraction of the animation duration, by which the children's animations are offset. |
void |
setInterpolator(Context context,
int resourceID)
Sets the interpolator used to interpolate the delays between the children. |
void |
setInterpolator(Interpolator interpolator)
Sets the interpolator used to interpolate the delays between the children. |
void |
setOrder(int order)
Sets the order used to compute the delay of each child's animation. |
void |
start()
Starts the animation. |
boolean |
willOverlap()
Indicates whether two children's animations will overlap. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int ORDER_NORMAL
public static final int ORDER_REVERSE
public static final int ORDER_RANDOM
protected Animation mAnimation
protected Random mRandomizer
protected Interpolator mInterpolator
| Constructor Detail |
|---|
public LayoutAnimationController(Context context,
AttributeSet attrs)
context - the Context the view group is running in, through which
it can access the resourcesattrs - the attributes of the XML tag that is inflating the
layout animation controllerpublic LayoutAnimationController(Animation animation)
animation - the animation to use on each child of the view group
public LayoutAnimationController(Animation animation,
float delay)
animation - the animation to use on each child of the view groupdelay - the delay by which each child's animation must be offset| Method Detail |
|---|
public int getOrder()
ORDER_NORMAL, ORDER_REVERSE or
{@link #ORDER_RANDOM)public void setOrder(int order)
order - one of ORDER_NORMAL, ORDER_REVERSE or
ORDER_RANDOM
public void setAnimation(Context context,
int resourceID)
context - the context from which the animation must be inflatedresourceID - the resource identifier of the animationsetAnimation(Animation),
getAnimation()public void setAnimation(Animation animation)
animation - the animation to run on each child of the view groupsetAnimation(android.content.Context, int),
getAnimation()public Animation getAnimation()
Animation instancesetAnimation(android.content.Context, int),
setAnimation(Animation)
public void setInterpolator(Context context,
int resourceID)
context - the context from which the interpolator must be inflatedresourceID - the resource identifier of the interpolatorgetInterpolator(),
setInterpolator(Interpolator)public void setInterpolator(Interpolator interpolator)
interpolator - the interpolatorgetInterpolator(),
setInterpolator(Interpolator)public Interpolator getInterpolator()
Interpolatorpublic float getDelay()
setDelay(float)public void setDelay(float delay)
child animation delay = child index * delay * animation duration
delay - a fraction of the animation durationgetDelay()public boolean willOverlap()
public void start()
public final Animation getAnimationForView(View view)
LayoutAnimationController.AnimationParameters.
This method is called by view groups to obtain the animation to set on
a specific child.
view - the view to animate
getDelayForView(android.view.View)getDelay(),
setDelay(float),
getDelayForView(android.view.View)public boolean isDone()
protected long getDelayForView(View view)
child animation delay
milliseconds where:
child animation delay = child index * delayThe index is retrieved from the
LayoutAnimationController.AnimationParameters
found in the view's ViewGroup.LayoutParams.
view - the view for which to obtain the animation's delay
getAnimationForView(android.view.View),
getDelay(),
getTransformedIndex(android.view.animation.LayoutAnimationController.AnimationParameters),
ViewGroup.LayoutParamsprotected int getTransformedIndex(LayoutAnimationController.AnimationParameters params)
LayoutAnimationController.AnimationParameters
by the order returned by getOrder(). Subclasses should override
this method to provide additional support for other types of ordering.
This method should be invoked by
getDelayForView(android.view.View) prior to any computation.
params - the animation parameters containing the index
|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||