Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a3a4744e authored by Beverly's avatar Beverly
Browse files

Don't re-animate dialog dismissal

- If the GlobalActionsDialog or VolumeDialog are already
dismissing, don't restart their dismissing animations

Change-Id: Ib98857bfd0575d66f9d2d3d21a369686c0bffe02
Fixes: 112347302
Test: manual
parent db0c85b1
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -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() {
+7 −0
Original line number Diff line number Diff line
@@ -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();