Fix customizer state

QSFragment uses QSCustomizer#isCustomizing to determine what to show.
isCustomizing() = mCustomizing || mOpening.

Before this CL, if the customizer was hidden before it was fully opened,
it would thing it was still opening and QS would not be updated
correctly.

Test: manual
Fixes: 160509272
Change-Id: Iec9c896621502a1825f717f733b24bde2fe22509
This commit is contained in:
Fabian Kozynski
2020-07-07 14:28:43 -04:00
parent 7d42405bc5
commit edf7483fdf
2 changed files with 14 additions and 0 deletions

View File

@@ -104,4 +104,13 @@ public class QSDetailClipper {
public void showBackground() {
mBackground.showSecondLayer();
}
/**
* Cancels the animator if it's running.
*/
public void cancelAnimator() {
if (mAnimator != null) {
mAnimator.cancel();
}
}
}

View File

@@ -208,6 +208,7 @@ public class QSCustomizer extends LinearLayout implements OnMenuItemClickListene
public void showImmediately() {
if (!isShown) {
setVisibility(VISIBLE);
mClipper.cancelAnimator();
mClipper.showBackground();
isShown = true;
setTileSpecs();
@@ -230,6 +231,10 @@ public class QSCustomizer extends LinearLayout implements OnMenuItemClickListene
mUiEventLogger.log(QSEditEvent.QS_EDIT_CLOSED);
isShown = false;
mToolbar.dismissPopupMenus();
mClipper.cancelAnimator();
// Make sure we're not opening (because we're closing). Nobody can think we are
// customizing after the next two lines.
mOpening = false;
setCustomizing(false);
save();
if (animate) {