Methods Summary |
---|
public void | onAttachedToWindow()
super.onAttachedToWindow();
if (mAnim != null) {
mAnim.start();
}
mAttached = true;
|
public void | onDetachedFromWindow()
super.onDetachedFromWindow();
if (mAnim != null) {
mAnim.stop();
}
mAttached = false;
|
public void | setImageDrawable(android.graphics.drawable.Drawable drawable)
super.setImageDrawable(drawable);
updateAnim();
|
public void | setImageResource(int resid)
super.setImageResource(resid);
updateAnim();
|
private void | updateAnim()
Drawable drawable = getDrawable();
if (mAttached && mAnim != null) {
mAnim.stop();
}
if (drawable instanceof AnimationDrawable) {
mAnim = (AnimationDrawable)drawable;
if (mAttached) {
mAnim.start();
}
} else {
mAnim = null;
}
|