From 0974348d31938a5961971eb816749215c3b967d5 Mon Sep 17 00:00:00 2001 From: Mady Mellor Date: Wed, 28 Jul 2021 15:13:24 -0700 Subject: [PATCH] Manage menu changes - padding & size updates - scrim between bubble expanded view and the manage menu Test: manual - expand a bubble, tap on the manage menu, it should animate in with a scrim behind it. Bug: 183658858 Change-Id: I3053cdb61497434a0aeb49eb33f87a3dafb364d7 --- .../Shell/res/layout/bubble_manage_button.xml | 1 - .../Shell/res/layout/bubble_manage_menu.xml | 30 ++++++++-------- libs/WindowManager/Shell/res/values/dimen.xml | 4 +++ .../wm/shell/bubbles/BubbleStackView.java | 34 +++++++++++++++++-- 4 files changed, 50 insertions(+), 19 deletions(-) diff --git a/libs/WindowManager/Shell/res/layout/bubble_manage_button.xml b/libs/WindowManager/Shell/res/layout/bubble_manage_button.xml index c09ae53746da4..b333e33a7a5f2 100644 --- a/libs/WindowManager/Shell/res/layout/bubble_manage_button.xml +++ b/libs/WindowManager/Shell/res/layout/bubble_manage_button.xml @@ -22,7 +22,6 @@ android:layout_width="wrap_content" android:layout_height="40dp" android:layout_marginTop="8dp" - android:layout_marginLeft="16dp" android:layout_marginBottom="8dp" android:focusable="true" android:text="@string/manage_bubbles_text" diff --git a/libs/WindowManager/Shell/res/layout/bubble_manage_menu.xml b/libs/WindowManager/Shell/res/layout/bubble_manage_menu.xml index f4b3aca33dd7b..298ad3025b00d 100644 --- a/libs/WindowManager/Shell/res/layout/bubble_manage_menu.xml +++ b/libs/WindowManager/Shell/res/layout/bubble_manage_menu.xml @@ -25,15 +25,15 @@ android:id="@+id/bubble_manage_menu_dismiss_container" android:background="@drawable/bubble_manage_menu_row" android:layout_width="match_parent" - android:layout_height="48dp" + android:layout_height="@dimen/bubble_menu_item_height" android:gravity="center_vertical" - android:paddingStart="16dp" - android:paddingEnd="16dp" + android:paddingStart="@dimen/bubble_menu_padding" + android:paddingEnd="@dimen/bubble_menu_padding" android:orientation="horizontal"> @@ -50,15 +50,15 @@ android:id="@+id/bubble_manage_menu_dont_bubble_container" android:background="@drawable/bubble_manage_menu_row" android:layout_width="match_parent" - android:layout_height="48dp" + android:layout_height="@dimen/bubble_menu_item_height" android:gravity="center_vertical" - android:paddingStart="16dp" - android:paddingEnd="16dp" + android:paddingStart="@dimen/bubble_menu_padding" + android:paddingEnd="@dimen/bubble_menu_padding" android:orientation="horizontal"> @@ -75,16 +75,16 @@ android:id="@+id/bubble_manage_menu_settings_container" android:background="@drawable/bubble_manage_menu_row" android:layout_width="match_parent" - android:layout_height="48dp" + android:layout_height="@dimen/bubble_menu_item_height" android:gravity="center_vertical" - android:paddingStart="16dp" - android:paddingEnd="16dp" + android:paddingStart="@dimen/bubble_menu_padding" + android:paddingEnd="@dimen/bubble_menu_padding" android:orientation="horizontal"> 56dp 60dp + + 16dp + + 24dp 144dp diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleStackView.java b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleStackView.java index ab3012c30e0dc..1c48e2e5e6cf2 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleStackView.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleStackView.java @@ -107,9 +107,6 @@ public class BubbleStackView extends FrameLayout */ private static final float FLYOUT_OVERSCROLL_ATTENUATION_FACTOR = 8f; - /** Duration of the flyout alpha animations. */ - private static final int FLYOUT_ALPHA_ANIMATION_DURATION = 100; - private static final int FADE_IN_DURATION = 320; /** Percent to darken the bubbles when they're in the dismiss target. */ @@ -123,6 +120,8 @@ public class BubbleStackView extends FrameLayout private static final int EXPANDED_VIEW_ALPHA_ANIMATION_DURATION = 150; + private static final int MANAGE_MENU_SCRIM_ANIM_DURATION = 150; + private static final float SCRIM_ALPHA = 0.6f; /** @@ -199,6 +198,7 @@ public class BubbleStackView extends FrameLayout private ExpandedAnimationController mExpandedAnimationController; private View mScrim; + private View mManageMenuScrim; private FrameLayout mExpandedViewContainer; /** Matrix used to scale the expanded view container with a given pivot point. */ @@ -853,6 +853,14 @@ public class BubbleStackView extends FrameLayout addView(mScrim); mScrim.setAlpha(0f); + mManageMenuScrim = new View(getContext()); + mManageMenuScrim.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO); + mManageMenuScrim.setBackgroundDrawable(new ColorDrawable( + getResources().getColor(android.R.color.system_neutral1_1000))); + addView(mManageMenuScrim, new LayoutParams(MATCH_PARENT, MATCH_PARENT)); + mManageMenuScrim.setAlpha(0f); + mManageMenuScrim.setVisibility(INVISIBLE); + mOrientationChangedListener = (v, left, top, right, bottom, oldLeft, oldTop, oldRight, oldBottom) -> { mPositioner.update(); @@ -1211,6 +1219,8 @@ public class BubbleStackView extends FrameLayout updateExpandedViewTheme(); mScrim.setBackgroundDrawable(new ColorDrawable( getResources().getColor(android.R.color.system_neutral1_1000))); + mManageMenuScrim.setBackgroundDrawable(new ColorDrawable( + getResources().getColor(android.R.color.system_neutral1_1000))); } /** @@ -2495,6 +2505,24 @@ public class BubbleStackView extends FrameLayout return; } + if (show) { + mManageMenuScrim.setVisibility(VISIBLE); + mManageMenuScrim.setTranslationZ(mManageMenu.getElevation() - 1f); + } + Runnable endAction = () -> { + if (!show) { + mManageMenuScrim.setVisibility(INVISIBLE); + mManageMenuScrim.setTranslationZ(0f); + } + }; + + mManageMenuScrim.animate() + .setDuration(MANAGE_MENU_SCRIM_ANIM_DURATION) + .setInterpolator(show ? ALPHA_IN : ALPHA_OUT) + .alpha(show ? SCRIM_ALPHA : 0f) + .withEndAction(endAction) + .start(); + // If available, update the manage menu's settings option with the expanded bubble's app // name and icon. if (show && mBubbleData.hasBubbleInStackWithKey(mExpandedBubble.getKey())) {