OSDN Git Service

Fix Flashlight tile animation
authorJason Monk <jmonk@google.com>
Thu, 4 Jun 2015 17:36:14 +0000 (13:36 -0400)
committerJason Monk <jmonk@google.com>
Thu, 4 Jun 2015 17:36:14 +0000 (13:36 -0400)
Don't refresh the state if its not different.
(This way setAllowAnimation won't get called when it shouldn't)

Bug: 21335624
Change-Id: Id6f8961b32d12141db5ac0bb847e4751b8a159b8

packages/SystemUI/src/com/android/systemui/qs/tiles/FlashlightTile.java

index 0369ab5..5d74604 100644 (file)
@@ -74,7 +74,11 @@ public class FlashlightTile extends QSTile<QSTile.BooleanState> implements
         state.visible = mFlashlightController.isAvailable();
         state.label = mHost.getContext().getString(R.string.quick_settings_flashlight_label);
         if (arg instanceof UserBoolean) {
-            state.value = ((UserBoolean) arg).value;
+            boolean value = ((UserBoolean) arg).value;
+            if (value == state.value) {
+                return;
+            }
+            state.value = value;
         }
         final AnimationIcon icon = state.value ? mEnable : mDisable;
         icon.setAllowAnimation(arg instanceof UserBoolean && ((UserBoolean) arg).userInitiated);