Methods Summary |
---|
public void | onAttachedToWindow()
super.onAttachedToWindow();
mAttached = true;
updateAnim();
|
public void | onDetachedFromWindow()
super.onDetachedFromWindow();
if (mAnim != null) {
mAnim.stop();
}
mAttached = false;
|
protected void | onVisibilityChanged(android.view.View changedView, int vis)
super.onVisibilityChanged(changedView, vis);
if (mAnim != null) {
if (isShown()) {
mAnim.start();
} else {
mAnim.stop();
}
}
|
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 (isShown()) {
mAnim.start();
}
} else {
mAnim = null;
}
|