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

Commit b21c2cc8 authored by Mady Mellor's avatar Mady Mellor Committed by Android (Google) Code Review
Browse files

Merge "Share the scrim value with launcher" into main

parents 5abbcde3 77011b6f
Loading
Loading
Loading
Loading
+7 −8
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import static com.android.wm.shell.bubbles.BubbleDebugConfig.DEBUG_BUBBLE_STACK_
import static com.android.wm.shell.bubbles.BubbleDebugConfig.TAG_BUBBLES;
import static com.android.wm.shell.bubbles.BubbleDebugConfig.TAG_WITH_CLASS_NAME;
import static com.android.wm.shell.bubbles.BubblePositioner.NUM_VISIBLE_WHEN_RESTING;
import static com.android.wm.shell.common.bubbles.BubbleConstants.BUBBLE_EXPANDED_SCRIM_ALPHA;
import static com.android.wm.shell.protolog.ShellProtoLogGroup.WM_SHELL_BUBBLES;

import android.animation.Animator;
@@ -131,9 +132,6 @@ public class BubbleStackView extends FrameLayout

    private static final int EXPANDED_VIEW_ALPHA_ANIMATION_DURATION = 150;

    /** Should be kept in sync with value in TaskbarScrimViewController. */
    private static final float SCRIM_ALPHA = 0.32f;

    /** Minimum alpha value for scrim when alpha is being changed via drag */
    private static final float MIN_SCRIM_ALPHA_FOR_DRAG = 0.2f;

@@ -780,14 +778,15 @@ public class BubbleStackView extends FrameLayout
        private float getScrimAlphaForDrag(float dragAmount) {
            // dragAmount should be negative as we allow scroll up only
            if (mExpandedBubble != null && mExpandedBubble.getExpandedView() != null) {
                float alphaRange = SCRIM_ALPHA - MIN_SCRIM_ALPHA_FOR_DRAG;
                float alphaRange = BUBBLE_EXPANDED_SCRIM_ALPHA - MIN_SCRIM_ALPHA_FOR_DRAG;

                int dragMax = mExpandedBubble.getExpandedView().getContentHeight();
                float dragFraction = dragAmount / dragMax;

                return Math.max(SCRIM_ALPHA - alphaRange * dragFraction, MIN_SCRIM_ALPHA_FOR_DRAG);
                return Math.max(BUBBLE_EXPANDED_SCRIM_ALPHA - alphaRange * dragFraction,
                        MIN_SCRIM_ALPHA_FOR_DRAG);
            }
            return SCRIM_ALPHA;
            return BUBBLE_EXPANDED_SCRIM_ALPHA;
        }
    };

@@ -2215,7 +2214,7 @@ public class BubbleStackView extends FrameLayout
        if (show) {
            mScrim.animate()
                    .setInterpolator(ALPHA_IN)
                    .alpha(SCRIM_ALPHA)
                    .alpha(BUBBLE_EXPANDED_SCRIM_ALPHA)
                    .setListener(listener)
                    .start();
        } else {
@@ -2944,7 +2943,7 @@ public class BubbleStackView extends FrameLayout
        mBubbleController.getSysuiProxy().onManageMenuExpandChanged(show);
        mManageMenuScrim.animate()
                .setInterpolator(show ? ALPHA_IN : ALPHA_OUT)
                .alpha(show ? SCRIM_ALPHA : 0f)
                .alpha(show ? BUBBLE_EXPANDED_SCRIM_ALPHA : 0f)
                .withEndAction(endAction)
                .start();

+26 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2023 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.wm.shell.common.bubbles;

/**
 * Constants shared between bubbles in shell & things we have to do for bubbles in launcher.
 */
public class BubbleConstants {

    /** The alpha for the scrim shown when bubbles are expanded. */
    public static float BUBBLE_EXPANDED_SCRIM_ALPHA = .32f;
}