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
This commit is contained in:
Mady Mellor
2021-07-28 15:13:24 -07:00
parent 31075face6
commit 0974348d31
4 changed files with 50 additions and 19 deletions

View File

@@ -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"

View File

@@ -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">
<ImageView
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_width="@dimen/bubble_menu_icon_size"
android:layout_height="@dimen/bubble_menu_icon_size"
android:src="@drawable/ic_remove_no_shadow"
android:tint="@color/bubbles_icon_tint"/>
@@ -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">
<ImageView
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_width="@dimen/bubble_menu_icon_size"
android:layout_height="@dimen/bubble_menu_icon_size"
android:src="@drawable/bubble_ic_stop_bubble"
android:tint="@color/bubbles_icon_tint"/>
@@ -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">
<ImageView
android:id="@+id/bubble_manage_menu_settings_icon"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_width="@dimen/bubble_menu_icon_size"
android:layout_height="@dimen/bubble_menu_icon_size"
android:src="@drawable/ic_remove_no_shadow"/>
<TextView

View File

@@ -152,6 +152,10 @@
<dimen name="bubble_manage_button_height">56dp</dimen>
<!-- Height of an item in the bubble manage menu. -->
<dimen name="bubble_menu_item_height">60dp</dimen>
<!-- Padding applied to the bubble manage menu. -->
<dimen name="bubble_menu_padding">16dp</dimen>
<!-- Size of the icons in the manage menu. -->
<dimen name="bubble_menu_icon_size">24dp</dimen>
<!-- Max width of the message bubble-->
<dimen name="bubble_message_max_width">144dp</dimen>
<!-- Min width of the message bubble -->

View File

@@ -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())) {