public class DrawableHolder extends Object implements Animator.AnimatorListener
Modifier and Type | Field and Description |
---|---|
static DecelerateInterpolator |
EASE_OUT_INTERPOLATOR |
Constructor and Description |
---|
DrawableHolder(BitmapDrawable drawable) |
DrawableHolder(BitmapDrawable drawable,
float x,
float y) |
Modifier and Type | Method and Description |
---|---|
ObjectAnimator |
addAnimTo(long duration,
long delay,
String property,
float toValue,
boolean replace)
Adds an animation that interpolates given property from its current value
to the given value.
|
void |
clearAnimations()
Stops all animations and removes them from the list.
|
void |
draw(Canvas canvas)
Draw this object to the canvas using the properties defined in this class.
|
float |
getAlpha() |
BitmapDrawable |
getDrawable() |
int |
getHeight() |
float |
getScaleX() |
float |
getScaleY() |
int |
getWidth() |
float |
getX() |
float |
getY() |
void |
onAnimationCancel(Animator animation)
Notifies the cancellation of the animation.
|
void |
onAnimationEnd(Animator animation)
Notifies the end of the animation.
|
void |
onAnimationRepeat(Animator animation)
Notifies the repetition of the animation.
|
void |
onAnimationStart(Animator animation)
Notifies the start of the animation.
|
void |
removeAnimationFor(String property)
Stops all animations for the given property and removes it from the list.
|
void |
setAlpha(float alpha) |
void |
setScaleX(float value) |
void |
setScaleY(float value) |
void |
setX(float value) |
void |
setY(float value) |
void |
startAnimations(ValueAnimator.AnimatorUpdateListener listener)
Starts all animations added since the last call to this function.
|
public static final DecelerateInterpolator EASE_OUT_INTERPOLATOR
public DrawableHolder(BitmapDrawable drawable)
public DrawableHolder(BitmapDrawable drawable, float x, float y)
public ObjectAnimator addAnimTo(long duration, long delay, String property, float toValue, boolean replace)
duration
- the duration, in ms.delay
- the delay to start the animation, in ms.property
- the property to animatetoValue
- the target valuereplace
- if true, replace the current animation with this one.public void removeAnimationFor(String property)
property
- public void clearAnimations()
public void draw(Canvas canvas)
canvas
- canvas to draw intopublic void startAnimations(ValueAnimator.AnimatorUpdateListener listener)
listener
- an optional listener to add to the animations. Typically used to know when
to invalidate the surface these are being drawn to.public void setX(float value)
public void setY(float value)
public void setScaleX(float value)
public void setScaleY(float value)
public void setAlpha(float alpha)
public float getX()
public float getY()
public float getScaleX()
public float getScaleY()
public float getAlpha()
public BitmapDrawable getDrawable()
public int getWidth()
public int getHeight()
public void onAnimationCancel(Animator animation)
Animator.AnimatorListener
Notifies the cancellation of the animation. This callback is not invoked for animations with repeat count set to INFINITE.
onAnimationCancel
in interface Animator.AnimatorListener
animation
- The animation which was canceled.public void onAnimationEnd(Animator animation)
Animator.AnimatorListener
Notifies the end of the animation. This callback is not invoked for animations with repeat count set to INFINITE.
onAnimationEnd
in interface Animator.AnimatorListener
animation
- The animation which reached its end.public void onAnimationRepeat(Animator animation)
Animator.AnimatorListener
Notifies the repetition of the animation.
onAnimationRepeat
in interface Animator.AnimatorListener
animation
- The animation which was repeated.public void onAnimationStart(Animator animation)
Animator.AnimatorListener
Notifies the start of the animation.
onAnimationStart
in interface Animator.AnimatorListener
animation
- The started animation.