diff options
author | Joe Onorato <joeo@android.com> | 2010-09-29 14:21:06 -0700 |
---|---|---|
committer | Joe Onorato <joeo@android.com> | 2010-09-29 14:21:06 -0700 |
commit | 1e7277e20465be39e30d7e84192c40c4c7b55f89 (patch) | |
tree | 0db73408e14880035cdab9f7aad8464b639a3790 /packages/SystemUI | |
parent | f01a873029641da2155ca1882f311d8f4e92675a (diff) | |
download | frameworks_base-1e7277e20465be39e30d7e84192c40c4c7b55f89.zip frameworks_base-1e7277e20465be39e30d7e84192c40c4c7b55f89.tar.gz frameworks_base-1e7277e20465be39e30d7e84192c40c4c7b55f89.tar.bz2 |
AnimatedImageView: Stop the animation when we're not visible.
Change-Id: I5dedc4048806f1ea44ef4777ccf578a29e79869b
Diffstat (limited to 'packages/SystemUI')
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/AnimatedImageView.java | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/AnimatedImageView.java b/packages/SystemUI/src/com/android/systemui/statusbar/AnimatedImageView.java index 70d4d6a..d4491d8 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/AnimatedImageView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/AnimatedImageView.java @@ -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(); + } + } + } } |