Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9a042772 authored by Joe Onorato's avatar Joe Onorato Committed by Android Git Automerger
Browse files

am 2a0b3c0d: Merge "AnimatedImageView: Stop the animation when we\'re not...

am 2a0b3c0d: Merge "AnimatedImageView: Stop the animation when we\'re not visible." into gingerbread

Merge commit '2a0b3c0d' into gingerbread-plus-aosp

* commit '2a0b3c0d':
  AnimatedImageView: Stop the animation when we're not visible.
parents 5cf44f69 2a0b3c0d
Loading
Loading
Loading
Loading
+15 −4
Original line number Diff line number Diff line
@@ -20,6 +20,8 @@ import android.content.Context;
import android.graphics.drawable.AnimationDrawable;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.util.Slog;
import android.view.View;
import android.widget.ImageView;
import android.widget.RemoteViews.RemoteView;

@@ -43,7 +45,7 @@ public class AnimatedImageView extends ImageView {
        }
        if (drawable instanceof AnimationDrawable) {
            mAnim = (AnimationDrawable)drawable;
            if (mAttached) {
            if (isShown()) {
                mAnim.start();
            }
        } else {
@@ -67,9 +69,6 @@ public class AnimatedImageView extends ImageView {
    @Override
    public void onAttachedToWindow() {
        super.onAttachedToWindow();
        if (mAnim != null) {
            mAnim.start();
        }
        mAttached = true;
    }

@@ -81,5 +80,17 @@ public class AnimatedImageView extends ImageView {
        }
        mAttached = false;
    }

    @Override
    protected void onVisibilityChanged(View changedView, int vis) {
        super.onVisibilityChanged(changedView, vis);
        if (mAnim != null) {
            if (isShown()) {
                mAnim.start();
            } else {
                mAnim.stop();
            }
        }
    }
}