Methods Summary |
---|
public android.animation.ObjectAnimator | addAnimTo(long duration, long delay, java.lang.String property, float toValue, boolean replace)Adds an animation that interpolates given property from its current value
to the given value.
if (replace) removeAnimationFor(property);
ObjectAnimator anim = ObjectAnimator.ofFloat(this, property, toValue);
anim.setDuration(duration);
anim.setStartDelay(delay);
anim.setInterpolator(EASE_OUT_INTERPOLATOR);
this.addAnimation(anim, replace);
if (DBG) Log.v(TAG, "animationCount = " + mAnimators.size());
return anim;
|
private com.android.internal.widget.DrawableHolder | addAnimation(android.animation.ObjectAnimator anim, boolean overwrite)Adds the given animation to the list of animations for this object.
if (anim != null)
mAnimators.add(anim);
mNeedToStart.add(anim);
return this;
|
public void | clearAnimations()Stops all animations and removes them from the list.
for (ObjectAnimator currentAnim : mAnimators) {
currentAnim.cancel();
}
mAnimators.clear();
|
public void | draw(android.graphics.Canvas canvas)Draw this object to the canvas using the properties defined in this class.
final float threshold = 1.0f / 256.0f; // contribution less than 1 LSB of RGB byte
if (mAlpha <= threshold) // don't bother if it won't show up
return;
canvas.save(Canvas.MATRIX_SAVE_FLAG);
canvas.translate(mX, mY);
canvas.scale(mScaleX, mScaleY);
canvas.translate(-0.5f*getWidth(), -0.5f*getHeight());
mDrawable.setAlpha((int) Math.round(mAlpha * 255f));
mDrawable.draw(canvas);
canvas.restore();
|
public float | getAlpha()
return mAlpha;
|
public android.graphics.drawable.BitmapDrawable | getDrawable()
return mDrawable;
|
public int | getHeight()
return mDrawable.getIntrinsicHeight();
|
public float | getScaleX()
return mScaleX;
|
public float | getScaleY()
return mScaleY;
|
public int | getWidth()
return mDrawable.getIntrinsicWidth();
|
public float | getX()
return mX;
|
public float | getY()
return mY;
|
public void | onAnimationCancel(android.animation.Animator animation)
|
public void | onAnimationEnd(android.animation.Animator animation)
mAnimators.remove(animation);
|
public void | onAnimationRepeat(android.animation.Animator animation)
|
public void | onAnimationStart(android.animation.Animator animation)
|
public void | removeAnimationFor(java.lang.String property)Stops all animations for the given property and removes it from the list.
ArrayList<ObjectAnimator> removalList = (ArrayList<ObjectAnimator>)mAnimators.clone();
for (ObjectAnimator currentAnim : removalList) {
if (property.equals(currentAnim.getPropertyName())) {
currentAnim.cancel();
}
}
|
public void | setAlpha(float alpha)
mAlpha = alpha;
|
public void | setScaleX(float value)
mScaleX = value;
|
public void | setScaleY(float value)
mScaleY = value;
|
public void | setX(float value)
mX = value;
|
public void | setY(float value)
mY = value;
|
public void | startAnimations(ValueAnimator.AnimatorUpdateListener listener)Starts all animations added since the last call to this function. Used to synchronize
animations.
for (int i = 0; i < mNeedToStart.size(); i++) {
ObjectAnimator anim = mNeedToStart.get(i);
anim.addUpdateListener(listener);
anim.addListener(this);
anim.start();
}
mNeedToStart.clear();
|