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

Commit 82f8bba4 authored by Ivan Tkachenko's avatar Ivan Tkachenko Committed by Automerger Merge Worker
Browse files

Merge "Bubble Manage menu initial position" into udc-dev am: 91775542

parents 1680255d 91775542
Loading
Loading
Loading
Loading
+22 −3
Original line number Diff line number Diff line
@@ -2922,14 +2922,15 @@ public class BubbleStackView extends FrameLayout
        final float targetX = isLtr
                ? mTempRect.left - margin
                : mTempRect.right + margin - mManageMenu.getWidth();
        final float targetY = mTempRect.bottom - mManageMenu.getHeight();
        final float menuHeight = getVisibleManageMenuHeight();
        final float targetY = mTempRect.bottom - menuHeight;

        final float xOffsetForAnimation = (isLtr ? 1 : -1) * mManageMenu.getWidth() / 4f;
        if (show) {
            mManageMenu.setScaleX(0.5f);
            mManageMenu.setScaleY(0.5f);
            mManageMenu.setTranslationX(targetX - xOffsetForAnimation);
            mManageMenu.setTranslationY(targetY + mManageMenu.getHeight() / 4f);
            mManageMenu.setTranslationY(targetY + menuHeight / 4f);
            mManageMenu.setAlpha(0f);

            PhysicsAnimator.getInstance(mManageMenu)
@@ -2955,7 +2956,7 @@ public class BubbleStackView extends FrameLayout
                    .spring(DynamicAnimation.SCALE_X, 0.5f)
                    .spring(DynamicAnimation.SCALE_Y, 0.5f)
                    .spring(DynamicAnimation.TRANSLATION_X, targetX - xOffsetForAnimation)
                    .spring(DynamicAnimation.TRANSLATION_Y, targetY + mManageMenu.getHeight() / 4f)
                    .spring(DynamicAnimation.TRANSLATION_Y, targetY + menuHeight / 4f)
                    .withEndActions(() -> {
                        mManageMenu.setVisibility(View.INVISIBLE);
                        if (mExpandedBubble != null && mExpandedBubble.getExpandedView() != null) {
@@ -3271,6 +3272,24 @@ public class BubbleStackView extends FrameLayout
        return mBubbleContainer.indexOfChild(provider.getIconView());
    }

    /**
     * Menu height calculated for animation
     * It takes into account view visibility to get the correct total height
     */
    private float getVisibleManageMenuHeight() {
        float menuHeight = 0;

        for (int i = 0; i < mManageMenu.getChildCount(); i++) {
            View subview = mManageMenu.getChildAt(i);

            if (subview.getVisibility() == VISIBLE) {
                menuHeight += subview.getHeight();
            }
        }

        return menuHeight;
    }

    /**
     * @return the normalized x-axis position of the bubble stack rounded to 4 decimal places.
     */