summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/AnimatedImageView.java16
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java7
2 files changed, 21 insertions, 2 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/AnimatedImageView.java b/packages/SystemUI/src/com/android/systemui/statusbar/AnimatedImageView.java
index ae665c7fcee7..e5aad0336061 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/AnimatedImageView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/AnimatedImageView.java
@@ -32,6 +32,7 @@ public class AnimatedImageView extends ImageView {
private final boolean mHasOverlappingRendering;
AnimationDrawable mAnim;
boolean mAttached;
+ private boolean mAllowAnimation;
// Tracks the last image that was set, so that we don't refresh the image if it is exactly
// the same as the previous one. If this is a resid, we track that. If it's a drawable, we
@@ -56,6 +57,17 @@ public class AnimatedImageView extends ImageView {
}
}
+ public void setAllowAnimation(boolean allowAnimation) {
+ if (mAllowAnimation != allowAnimation) {
+ mAllowAnimation = allowAnimation;
+ updateAnim();
+ if (!mAllowAnimation && mAnim != null) {
+ // Reset drawable such that we show the first frame whenever we're not animating.
+ mAnim.setVisible(getVisibility() == VISIBLE, true /* restart */);
+ }
+ }
+ }
+
private void updateAnim() {
Drawable drawable = getDrawable();
if (mAttached && mAnim != null) {
@@ -63,7 +75,7 @@ public class AnimatedImageView extends ImageView {
}
if (drawable instanceof AnimationDrawable) {
mAnim = (AnimationDrawable) drawable;
- if (isShown()) {
+ if (isShown() && mAllowAnimation) {
mAnim.start();
}
} else {
@@ -114,7 +126,7 @@ public class AnimatedImageView extends ImageView {
protected void onVisibilityChanged(View changedView, int vis) {
super.onVisibilityChanged(changedView, vis);
if (mAnim != null) {
- if (isShown()) {
+ if (isShown() && mAllowAnimation) {
mAnim.start();
} else {
mAnim.stop();
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java b/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java
index 89694b33e035..05d47ec9af63 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java
@@ -756,9 +756,16 @@ public class StatusBarIconView extends AnimatedImageView {
updateIconScale();
updateDecorColor();
updateIconColor();
+ updateAllowAnimation();
}, dark, fade, delay);
}
+ private void updateAllowAnimation() {
+ if (mDarkAmount == 0 || mDarkAmount == 1) {
+ setAllowAnimation(mDarkAmount == 0);
+ }
+ }
+
public interface OnVisibilityChangedListener {
void onVisibilityChanged(int newVisibility);
}