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

Commit 5fad06bf authored by Mykola Podolian's avatar Mykola Podolian Committed by Android (Google) Code Review
Browse files

Merge "Updated bubble bar expanded view handle appearance." into main

parents 538cb754 ef3b53c0
Loading
Loading
Loading
Loading
+4 −6
Original line number Diff line number Diff line
@@ -247,13 +247,11 @@
    <!-- Padding for the bubble popup view contents. -->
    <dimen name="bubble_popup_padding">24dp</dimen>
    <!-- The size of the caption bar inset at the top of bubble bar expanded view. -->
    <dimen name="bubble_bar_expanded_view_caption_height">32dp</dimen>
    <dimen name="bubble_bar_expanded_view_caption_height">36dp</dimen>
    <!-- The width of the caption bar at the top of bubble bar expanded view. -->
    <dimen name="bubble_bar_expanded_view_caption_width">128dp</dimen>
    <!-- The height of the dots shown for the caption menu in the bubble bar expanded view.. -->
    <dimen name="bubble_bar_expanded_view_caption_dot_size">4dp</dimen>
    <!-- The spacing between the dots for the caption menu in the bubble bar expanded view.. -->
    <dimen name="bubble_bar_expanded_view_caption_dot_spacing">4dp</dimen>
    <dimen name="bubble_bar_expanded_view_caption_width">80dp</dimen>
    <!-- The height of the handle shown for the caption menu in the bubble bar expanded view. -->
    <dimen name="bubble_bar_expanded_view_handle_height">4dp</dimen>
    <!-- Width of the expanded bubble bar view shown when the bubble is expanded. -->
    <dimen name="bubble_bar_expanded_view_width">412dp</dimen>
    <!-- Minimum width of the bubble bar manage menu. -->
+9 −29
Original line number Diff line number Diff line
@@ -37,15 +37,11 @@ import com.android.wm.shell.R;
 */
public class BubbleBarHandleView extends View {
    private static final long COLOR_CHANGE_DURATION = 120;

    // The handle view is currently rendered as 3 evenly spaced dots.
    private int mDotSize;
    private int mDotSpacing;
    // Path used to draw the dots
    private final Path mPath = new Path();

    private @ColorInt int mHandleLightColor;
    private @ColorInt int mHandleDarkColor;
    private final @ColorInt int mHandleLightColor;
    private final @ColorInt int mHandleDarkColor;
    private @Nullable ObjectAnimator mColorChangeAnim;

    public BubbleBarHandleView(Context context) {
@@ -63,10 +59,8 @@ public class BubbleBarHandleView extends View {
    public BubbleBarHandleView(Context context, AttributeSet attrs, int defStyleAttr,
            int defStyleRes) {
        super(context, attrs, defStyleAttr, defStyleRes);
        mDotSize = getResources().getDimensionPixelSize(
                R.dimen.bubble_bar_expanded_view_caption_dot_size);
        mDotSpacing = getResources().getDimensionPixelSize(
                R.dimen.bubble_bar_expanded_view_caption_dot_spacing);
        final int handleHeight = getResources().getDimensionPixelSize(
                R.dimen.bubble_bar_expanded_view_handle_height);
        mHandleLightColor = ContextCompat.getColor(getContext(),
                R.color.bubble_bar_expanded_view_handle_light);
        mHandleDarkColor = ContextCompat.getColor(getContext(),
@@ -76,27 +70,13 @@ public class BubbleBarHandleView extends View {
        setOutlineProvider(new ViewOutlineProvider() {
            @Override
            public void getOutline(View view, Outline outline) {
                final int handleCenterX = view.getWidth() / 2;
                final int handleCenterY = view.getHeight() / 2;
                final int handleTotalWidth = mDotSize * 3 + mDotSpacing * 2;
                final int handleLeft = handleCenterX - handleTotalWidth / 2;
                final int handleTop = handleCenterY - mDotSize / 2;
                final int handleBottom = handleTop + mDotSize;
                RectF dot1 = new RectF(
                        handleLeft, handleTop,
                        handleLeft + mDotSize, handleBottom);
                RectF dot2 = new RectF(
                        dot1.right + mDotSpacing, handleTop,
                        dot1.right + mDotSpacing + mDotSize, handleBottom
                );
                RectF dot3 = new RectF(
                        dot2.right + mDotSpacing, handleTop,
                        dot2.right + mDotSpacing + mDotSize, handleBottom
                );
                final int handleTop = handleCenterY - handleHeight / 2;
                final int handleBottom = handleTop + handleHeight;
                final int radius = handleHeight / 2;
                RectF handle = new RectF(/* left = */ 0, handleTop, view.getWidth(), handleBottom);
                mPath.reset();
                mPath.addOval(dot1, Path.Direction.CW);
                mPath.addOval(dot2, Path.Direction.CW);
                mPath.addOval(dot3, Path.Direction.CW);
                mPath.addRoundRect(handle, radius, radius, Path.Direction.CW);
                outline.setPath(mPath);
            }
        });