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

Commit 743356ad authored by John Spurlock's avatar John Spurlock
Browse files

More hideytoast stabilization.

Back to Gravity.TOP workaround to keep the hideybar confirmation
toast stable during navbar enter/exit animation.

Reverts part of Ifa380e387389ed9917336ad19dfde49f67a5fb10

Change-Id: I1e2e54851f2030603d43df611a616101f19bdab3
parent de44c828
Loading
Loading
Loading
Loading
+8 −0
Original line number Original line Diff line number Diff line
@@ -1964,12 +1964,20 @@ public class PhoneStatusBar extends BaseStatusBar {
            mHideybarConfirmation = Toast.makeBar(mContext, msg, Toast.LENGTH_INFINITE)
            mHideybarConfirmation = Toast.makeBar(mContext, msg, Toast.LENGTH_INFINITE)
                    .setAction(com.android.internal.R.string.ok, mHideybarConfirmationAction);
                    .setAction(com.android.internal.R.string.ok, mHideybarConfirmationAction);
            View v = mHideybarConfirmation.getView();
            View v = mHideybarConfirmation.getView();
            v.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
            boolean isGloballyConfirmed = Prefs.read(mContext)
            boolean isGloballyConfirmed = Prefs.read(mContext)
                    .getBoolean(Prefs.HIDEYBAR_CONFIRMED, false);
                    .getBoolean(Prefs.HIDEYBAR_CONFIRMED, false);
            if (isGloballyConfirmed) {
            if (isGloballyConfirmed) {
                // dismiss on outside touch if globally confirmed
                // dismiss on outside touch if globally confirmed
                v.setOnTouchListener(mDismissHideybarConfirmationOnTouchOutside);
                v.setOnTouchListener(mDismissHideybarConfirmationOnTouchOutside);
            }
            }
            // position at the bottom like normal toasts, but use top gravity
            // to avoid jumping around when showing/hiding the nav bar
            v.measure(MeasureSpec.UNSPECIFIED, MeasureSpec.UNSPECIFIED);
            int offsetY = mContext.getResources().getDimensionPixelSize(
                    com.android.internal.R.dimen.toast_y_offset);
            mHideybarConfirmation.setGravity(Gravity.TOP,
                    0, mCurrentDisplaySize.y - v.getMeasuredHeight() / 2 - offsetY);
            // show the confirmation
            // show the confirmation
            mHideybarConfirmation.show();
            mHideybarConfirmation.show();
        } else if (!visible) {
        } else if (!visible) {