FileDocCategorySizeDatePackage
AnimatedImageView.javaAPI DocAndroid 1.5 API1654Wed May 06 22:42:00 BST 2009com.android.server.status

AnimatedImageView

public class AnimatedImageView extends android.widget.ImageView

Fields Summary
android.graphics.drawable.AnimationDrawable
mAnim
boolean
mAttached
Constructors Summary
public AnimatedImageView(android.content.Context context)

        super(context);
    
public AnimatedImageView(android.content.Context context, android.util.AttributeSet attrs)

        super(context, attrs);
    
Methods Summary
public voidonAttachedToWindow()

        super.onAttachedToWindow();
        if (mAnim != null) {
            mAnim.start();
        }
        mAttached = true;
    
public voidonDetachedFromWindow()

        super.onDetachedFromWindow();
        if (mAnim != null) {
            mAnim.stop();
        }
        mAttached = false;
    
public voidsetImageDrawable(android.graphics.drawable.Drawable drawable)

        super.setImageDrawable(drawable);
        updateAnim();
    
public voidsetImageResource(int resid)

        super.setImageResource(resid);
        updateAnim();
    
private voidupdateAnim()

        Drawable drawable = getDrawable();
        if (mAttached && mAnim != null) {
            mAnim.stop();
        }
        if (drawable instanceof AnimationDrawable) {
            mAnim = (AnimationDrawable)drawable;
            if (mAttached) {
                mAnim.start();
            }
        } else {
            mAnim = null;
        }