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

Commit 0ce3e08a authored by Abodunrinwa Toki's avatar Abodunrinwa Toki
Browse files

Fix FloatingToolbar.show()

*Finer cancel animation methods so we call only the necessary ones.

*Don't set the FloatingToolbarPopup content view's alpha to 0
 before showing it's popup window.

*FloatingToolbarPopup.dismiss() should run when toolbar is hidden.

Bug: 20456876
Change-Id: I2e7ff5f2ec56af2def0976fa8e770c651daaa3a3
parent 6446d979
Loading
Loading
Loading
Loading
+9 −8
Original line number Diff line number Diff line
@@ -433,15 +433,13 @@ public final class FloatingToolbar {

            mHidden = false;
            mDismissed = false;
            cancelAllAnimations();
            cancelDismissAndHideAnimations();
            cancelOverflowAnimations();
            // Make sure a panel is set as the content.
            if (mContentContainer.getChildCount() == 0) {
                setMainPanelAsContent();
            }
            preparePopupContent();
            // If we're yet to show the popup, set the container visibility to zero.
            // The "show" animation will make this visible.
            mContentContainer.setAlpha(0);
            mPopupWindow.showAtLocation(mParent, Gravity.NO_GRAVITY, x, y);
            setTouchableSurfaceInsetsComputer();
            runShowAnimation();
@@ -451,12 +449,13 @@ public final class FloatingToolbar {
         * Gets rid of this popup. If the popup isn't currently showing, this will be a no-op.
         */
        public void dismiss() {
            if (!isShowing()) {
            if (mDismissed) {
                return;
            }

            mHidden = false;
            mDismissed = true;
            mHideAnimation.cancel();
            runDismissAnimation();
            setZeroTouchableSurface();
        }
@@ -499,7 +498,7 @@ public final class FloatingToolbar {
                return;
            }

            cancelAllAnimations();
            cancelOverflowAnimations();
            preparePopupContent();
            mPopupWindow.update(x, y, getWidth(), getHeight());
        }
@@ -563,10 +562,12 @@ public final class FloatingToolbar {
            mHideAnimation.start();
        }

        private void cancelAllAnimations() {
            mShowAnimation.cancel();
        private void cancelDismissAndHideAnimations() {
            mDismissAnimation.cancel();
            mHideAnimation.cancel();
        }

        private void cancelOverflowAnimations() {
            mOpenOverflowAnimation.cancel();
            mCloseOverflowAnimation.cancel();
        }