OSDN Git Service

Hide QS customizer correctly
authorYoshinori Hirano <yoshinori.hirano@sonymobile.com>
Mon, 5 Sep 2016 07:11:59 +0000 (16:11 +0900)
committerYoshinori Hirano <Yoshinori.Hirano@sonymobile.com>
Tue, 18 Oct 2016 04:31:47 +0000 (04:31 +0000)
When users open and close QS customizer quickly, QSCustomizer#hide()
is not called because QSCustomizer#isCustomizing() returns false.
The isCustomizing() becomes true when the expand animation ends.
The hide() should be called even though the animation is ongoing.

Bug: 30545089
Test: manual - open and close QS customizer quickly

Change-Id: Ic483addfb6ae9da31c997fec7778e5acd718c353

packages/SystemUI/src/com/android/systemui/qs/QSPanel.java
packages/SystemUI/src/com/android/systemui/qs/customize/QSCustomizer.java

index 636a9a5..9d4bb48 100644 (file)
@@ -215,7 +215,7 @@ public class QSPanel extends LinearLayout implements Tunable, Callback {
     }
 
     public void onCollapse() {
-        if (mCustomizePanel != null && mCustomizePanel.isCustomizing()) {
+        if (mCustomizePanel != null && mCustomizePanel.isShown()) {
             mCustomizePanel.hide(mCustomizePanel.getWidth() / 2, mCustomizePanel.getHeight() / 2);
         }
     }
@@ -392,7 +392,7 @@ public class QSPanel extends LinearLayout implements Tunable, Callback {
     }
 
     public void closeDetail() {
-        if (mCustomizePanel != null && mCustomizePanel.isCustomizing()) {
+        if (mCustomizePanel != null && mCustomizePanel.isShown()) {
             // Treat this as a detail panel for now, to make things easy.
             mCustomizePanel.hide(mCustomizePanel.getWidth() / 2, mCustomizePanel.getHeight() / 2);
             return;
index 0de1e30..77da6d4 100644 (file)
@@ -162,6 +162,10 @@ public class QSCustomizer extends LinearLayout implements OnMenuItemClickListene
         }
     }
 
+    public boolean isShown() {
+        return isShown;
+    }
+
     private void setCustomizing(boolean customizing) {
         mCustomizing = customizing;
         mQsContainer.notifyCustomizeChanged();
@@ -216,7 +220,9 @@ public class QSCustomizer extends LinearLayout implements OnMenuItemClickListene
     private final AnimatorListener mExpandAnimationListener = new AnimatorListenerAdapter() {
         @Override
         public void onAnimationEnd(Animator animation) {
-            setCustomizing(true);
+            if (isShown) {
+                setCustomizing(true);
+            }
             mNotifQsContainer.setCustomizerAnimating(false);
         }