Merge "QS Detail: Don't animate switch before panel open" into nyc-mr1-dev
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSDetail.java b/packages/SystemUI/src/com/android/systemui/qs/QSDetail.java
index c63be9c..6206cef9 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QSDetail.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QSDetail.java
@@ -67,6 +67,8 @@
private boolean mTriggeredExpand;
private int mOpenX;
private int mOpenY;
+ private boolean mAnimating;
+ private boolean mSwitchState;
public QSDetail(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
@@ -158,7 +160,7 @@
mQsDetailHeader.setClickable(false);
} else {
mQsDetailHeaderSwitch.setVisibility(VISIBLE);
- mQsDetailHeaderSwitch.setChecked(toggleState);
+ handleToggleStateChanged(toggleState);
mQsDetailHeader.setClickable(true);
mQsDetailHeader.setOnClickListener(new OnClickListener() {
@Override
@@ -228,6 +230,7 @@
}
sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED);
if (visibleDiff) {
+ mAnimating = true;
if (mFullyExpanded || mDetailAdapter != null) {
setAlpha(1);
mClipper.animateCircularClip(x, y, mDetailAdapter != null, listener);
@@ -241,6 +244,10 @@
}
private void handleToggleStateChanged(boolean state) {
+ mSwitchState = state;
+ if (mAnimating) {
+ return;
+ }
mQsDetailHeaderSwitch.setChecked(state);
}
@@ -257,6 +264,10 @@
}
}
+ private void checkPendingAnimations() {
+ handleToggleStateChanged(mSwitchState);
+ }
+
private final QSPanel.Callback mQsPanelCallback = new QSPanel.Callback() {
@Override
public void onToggleStateChanged(final boolean state) {
@@ -294,6 +305,8 @@
// If we have been cancelled, remove the listener so that onAnimationEnd doesn't get
// called, this will avoid accidentally turning off the grid when we don't want to.
animation.removeListener(this);
+ mAnimating = false;
+ checkPendingAnimations();
};
@Override
@@ -303,6 +316,8 @@
mQsPanel.setGridContentVisibility(false);
mHeader.setVisibility(View.INVISIBLE);
}
+ mAnimating = false;
+ checkPendingAnimations();
}
};
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/BluetoothTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/BluetoothTile.java
index 7a23910..794610e 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/BluetoothTile.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/BluetoothTile.java
@@ -90,11 +90,11 @@
mHost.startActivityDismissingKeyguard(new Intent(Settings.ACTION_BLUETOOTH_SETTINGS));
return;
}
+ showDetail(true);
if (!mState.value) {
mState.value = true;
mController.setBluetoothEnabled(true);
}
- showDetail(true);
}
@Override
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/DndTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/DndTile.java
index 04cb553..91821ba 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/DndTile.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/DndTile.java
@@ -122,9 +122,9 @@
if (mState.value) {
mController.setZen(Global.ZEN_MODE_OFF, null, TAG);
} else {
+ showDetail(true);
int zen = Prefs.getInt(mContext, Prefs.Key.DND_FAVORITE_ZEN, Global.ZEN_MODE_ALARMS);
mController.setZen(zen, null, TAG);
- showDetail(true);
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/WifiTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/WifiTile.java
index 661212c..1f915ee 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/WifiTile.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/WifiTile.java
@@ -113,11 +113,11 @@
mHost.startActivityDismissingKeyguard(new Intent(Settings.ACTION_WIFI_SETTINGS));
return;
}
+ showDetail(true);
if (!mState.value) {
mController.setWifiEnabled(true);
mState.value = true;
}
- showDetail(true);
}
@Override