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

Commit 0786deae authored by mpodolian's avatar mpodolian
Browse files

Fixed issue with shadow for overflow icon

Made icons elevation animates to flat state while bubble bar is being
expanded and animate to full elevation while bubble bar is being
collapsed.

Test: Visual
Fixes: 295027436
Flag: ACONFIG com.android.wm.shell.enable_bubble_bar DEVELOPMENT
Change-Id: I8286cd79904367654e319d6a84a307bd64c28d93
parent b9ed7c15
Loading
Loading
Loading
Loading
+10 −6
Original line number Diff line number Diff line
@@ -581,6 +581,8 @@ public class BubbleBarView extends FrameLayout {
        final float ty = (mBubbleBarBounds.height() - mIconSize) / 2f;
        final boolean animate = getVisibility() == VISIBLE;
        final boolean onLeft = mBubbleBarLocation.isOnLeft(isLayoutRtl());
        // elevation state is opposite to widthState - when expanded all icons are flat
        float elevationState = (1 - widthState);
        for (int i = 0; i < bubbleCount; i++) {
            BubbleView bv = (BubbleView) getChildAt(i);
            bv.setTranslationY(ty);
@@ -599,17 +601,20 @@ public class BubbleBarView extends FrameLayout {
                expandedX = i * (mIconSize + mExpandedBarIconsSpacing);
                collapsedX = i == 0 ? 0 : mIconOverlapAmount;
            }

            if (bv == mDraggedBubbleView) {
                // if bubble is dragged set the elevation to bubble drag elevation
                bv.setZ(mDragElevation);
            } else {
                // otherwise slowly animate elevation while keeping correct Z ordering
                float fullElevationForChild = (MAX_BUBBLES * mBubbleElevation) - i;
                bv.setZ(fullElevationForChild * elevationState);
            }
            if (mIsBarExpanded) {
                // If bar is on the right, account for bubble bar expanding and shifting left
                final float expandedBarShift = onLeft ? 0 : currentWidth - expandedWidth;
                // where the bubble will end up when the animation ends
                final float targetX = expandedX + expandedBarShift;
                bv.setTranslationX(widthState * (targetX - collapsedX) + collapsedX);
                // if we're fully expanded, set the z level to 0 or to bubble elevation if dragged
                if (widthState == 1f) {
                    bv.setZ(bv == mDraggedBubbleView ? mBubbleElevation : 0);
                }
                // When we're expanded, we're not stacked so we're not behind the stack
                bv.setBehindStack(false, animate);
                bv.setAlpha(1);
@@ -618,7 +623,6 @@ public class BubbleBarView extends FrameLayout {
                final float collapsedBarShift = onLeft ? 0 : currentWidth - collapsedWidth;
                final float targetX = collapsedX + collapsedBarShift;
                bv.setTranslationX(widthState * (expandedX - targetX) + targetX);
                bv.setZ((MAX_BUBBLES * mBubbleElevation) - i);
                // If we're not the first bubble we're behind the stack
                bv.setBehindStack(i > 0, animate);
                // If we're fully collapsed, hide all bubbles except for the first 2. If there are