From 1dd7d07460b1044a5037a9e1c8a3eb1016a4b421 Mon Sep 17 00:00:00 2001 From: Yoshinori Hirano Date: Mon, 5 Sep 2016 16:11:59 +0900 Subject: [PATCH] Hide QS customizer correctly 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 --- .../SystemUI/src/com/android/systemui/qs/QSPanel.java | 4 ++-- .../com/android/systemui/qs/customize/QSCustomizer.java | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java b/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java index 636a9a5079a54..9d4bb4817b851 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java @@ -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; diff --git a/packages/SystemUI/src/com/android/systemui/qs/customize/QSCustomizer.java b/packages/SystemUI/src/com/android/systemui/qs/customize/QSCustomizer.java index 0de1e3022b6c9..77da6d4c7b211 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/customize/QSCustomizer.java +++ b/packages/SystemUI/src/com/android/systemui/qs/customize/QSCustomizer.java @@ -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); }