Merge "Don't re-animate dialog dismissal"
This commit is contained in:
committed by
Android (Google) Code Review
commit
ac16d84a34
@@ -1399,6 +1399,7 @@ class GlobalActionsDialog implements DialogInterface.OnDismissListener,
|
||||
private final ColorExtractor mColorExtractor;
|
||||
private boolean mKeyguardShowing;
|
||||
private boolean mShouldDisplaySeparatedButton;
|
||||
private boolean mShowing;
|
||||
|
||||
public ActionsDialog(Context context, OnClickListener clickListener, MyAdapter adapter,
|
||||
OnItemLongClickListener longClickListener, boolean shouldDisplaySeparatedButton) {
|
||||
@@ -1507,6 +1508,7 @@ class GlobalActionsDialog implements DialogInterface.OnDismissListener,
|
||||
@Override
|
||||
public void show() {
|
||||
super.show();
|
||||
mShowing = true;
|
||||
mGradientDrawable.setAlpha(0);
|
||||
mHardwareLayout.setTranslationX(getAnimTranslation());
|
||||
mHardwareLayout.setAlpha(0);
|
||||
@@ -1526,6 +1528,10 @@ class GlobalActionsDialog implements DialogInterface.OnDismissListener,
|
||||
|
||||
@Override
|
||||
public void dismiss() {
|
||||
if (!mShowing) {
|
||||
return;
|
||||
}
|
||||
mShowing = false;
|
||||
mHardwareLayout.setTranslationX(0);
|
||||
mHardwareLayout.setAlpha(1);
|
||||
mHardwareLayout.animate()
|
||||
@@ -1544,6 +1550,7 @@ class GlobalActionsDialog implements DialogInterface.OnDismissListener,
|
||||
|
||||
void dismissImmediately() {
|
||||
super.dismiss();
|
||||
mShowing = false;
|
||||
}
|
||||
|
||||
private float getAnimTranslation() {
|
||||
|
||||
@@ -149,6 +149,7 @@ public class VolumeDialogImpl implements VolumeDialog {
|
||||
private boolean mHovering = false;
|
||||
private boolean mShowActiveStreamOnly;
|
||||
private boolean mConfigChanged = false;
|
||||
private boolean mIsAnimatingDismiss = false;
|
||||
|
||||
public VolumeDialogImpl(Context context) {
|
||||
mContext = new ContextThemeWrapper(context, com.android.systemui.R.style.qs_theme);
|
||||
@@ -582,18 +583,24 @@ public class VolumeDialogImpl implements VolumeDialog {
|
||||
protected void dismissH(int reason) {
|
||||
mHandler.removeMessages(H.DISMISS);
|
||||
mHandler.removeMessages(H.SHOW);
|
||||
if (mIsAnimatingDismiss) {
|
||||
return;
|
||||
}
|
||||
mDialogView.animate().cancel();
|
||||
mIsAnimatingDismiss = false;
|
||||
mShowing = false;
|
||||
|
||||
mDialogView.setTranslationX(0);
|
||||
mDialogView.setAlpha(1);
|
||||
ViewPropertyAnimator animator = mDialogView.animate()
|
||||
.withStartAction(() -> mIsAnimatingDismiss = true)
|
||||
.alpha(0)
|
||||
.setDuration(250)
|
||||
.setInterpolator(new SystemUIInterpolators.LogAccelerateInterpolator())
|
||||
.withEndAction(() -> mHandler.postDelayed(() -> {
|
||||
if (D.BUG) Log.d(TAG, "mDialog.dismiss()");
|
||||
mDialog.dismiss();
|
||||
mIsAnimatingDismiss = false;
|
||||
}, 50));
|
||||
if (!isLandscape()) animator.translationX(mDialogView.getWidth() / 2);
|
||||
animator.start();
|
||||
|
||||
Reference in New Issue
Block a user