summaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorJoe Onorato <joeo@android.com>2010-09-30 11:26:02 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2010-09-30 11:26:02 -0700
commit0cf6418e090764b6880f5a8af19e8f7f7fc41858 (patch)
tree2728c279fb8080ace540ddc42bf23923d9d0f97f /packages
parent648e1aeb8ac3df60e5fbcdfe42976cb2dc241047 (diff)
parent9a042772c2d76dba3a541dc4190b7be1a438445a (diff)
downloadframeworks_base-0cf6418e090764b6880f5a8af19e8f7f7fc41858.zip
frameworks_base-0cf6418e090764b6880f5a8af19e8f7f7fc41858.tar.gz
frameworks_base-0cf6418e090764b6880f5a8af19e8f7f7fc41858.tar.bz2
am 9a042772: am 2a0b3c0d: Merge "AnimatedImageView: Stop the animation when we\'re not visible." into gingerbread
Merge commit '9a042772c2d76dba3a541dc4190b7be1a438445a' * commit '9a042772c2d76dba3a541dc4190b7be1a438445a': AnimatedImageView: Stop the animation when we're not visible.
Diffstat (limited to 'packages')
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/AnimatedImageView.java19
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();
+ }
+ }
+ }
}