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

Commit 31fbdae7 authored by Mady Mellor's avatar Mady Mellor Committed by Automerger Merge Worker
Browse files

Merge "Bubbles styling: flyout changes" into sc-dev am: 3952307a

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14508389

Change-Id: I32b94eb897e8a5fcd35d1ce466845f52f78b5418
parents 2a0d0038 3952307a
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -97,7 +97,7 @@
    <!-- How much the bubble flyout text container is elevated. -->
    <dimen name="bubble_flyout_elevation">4dp</dimen>
    <!-- How much padding is around the left and right sides of the flyout text. -->
    <dimen name="bubble_flyout_padding_x">12dp</dimen>
    <dimen name="bubble_flyout_padding_x">14dp</dimen>
    <!-- How much padding is around the top and bottom of the flyout text. -->
    <dimen name="bubble_flyout_padding_y">10dp</dimen>
    <!-- Size of the triangle that points from the flyout to the bubble stack. -->
+11 −6
Original line number Diff line number Diff line
@@ -65,6 +65,9 @@ public class BubbleFlyoutView extends FrameLayout {
    private static final long FLYOUT_FADE_OUT_DURATION = 150L;
    private static final long FLYOUT_FADE_IN_DURATION = 250L;

    // Whether the flyout view should show a pointer to the bubble.
    private static final boolean SHOW_POINTER = false;

    private final int mFlyoutPadding;
    private final int mFlyoutSpaceFromBubble;
    private final int mPointerSize;
@@ -166,14 +169,16 @@ public class BubbleFlyoutView extends FrameLayout {
        final Resources res = getResources();
        mFlyoutPadding = res.getDimensionPixelSize(R.dimen.bubble_flyout_padding_x);
        mFlyoutSpaceFromBubble = res.getDimensionPixelSize(R.dimen.bubble_flyout_space_from_bubble);
        mPointerSize = res.getDimensionPixelSize(R.dimen.bubble_flyout_pointer_size);
        mPointerSize = SHOW_POINTER
                ? res.getDimensionPixelSize(R.dimen.bubble_flyout_pointer_size)
                : 0;

        mBubbleElevation = res.getDimensionPixelSize(R.dimen.bubble_elevation);
        mFlyoutElevation = res.getDimensionPixelSize(R.dimen.bubble_flyout_elevation);

        final TypedArray ta = mContext.obtainStyledAttributes(
                new int[] {
                        android.R.attr.colorBackgroundFloating,
                        com.android.internal.R.attr.colorSurface,
                        android.R.attr.dialogCornerRadius});
        mFloatingBackgroundColor = ta.getColor(0, Color.WHITE);
        mCornerRadius = ta.getDimensionPixelSize(1, 0);
@@ -182,7 +187,7 @@ public class BubbleFlyoutView extends FrameLayout {
        // Add padding for the pointer on either side, onDraw will draw it in this space.
        setPadding(mPointerSize, 0, mPointerSize, 0);
        setWillNotDraw(false);
        setClipChildren(false);
        setClipChildren(!SHOW_POINTER);
        setTranslationZ(mFlyoutElevation);
        setOutlineProvider(new ViewOutlineProvider() {
            @Override
@@ -461,6 +466,7 @@ public class BubbleFlyoutView extends FrameLayout {
    /** Renders the 'pointer' triangle that points from the flyout to the bubble stack. */
    private void renderPointerTriangle(
            Canvas canvas, float currentFlyoutWidth, float currentFlyoutHeight) {
        if (!SHOW_POINTER) return;
        canvas.save();

        // Translation to apply for the 'retraction' effect as the flyout collapses.
@@ -488,13 +494,12 @@ public class BubbleFlyoutView extends FrameLayout {
        // current position.
        relevantTriangle.getOutline(mTriangleOutline);
        mTriangleOutline.offset((int) arrowTranslationX, (int) arrowTranslationY);

        canvas.restore();
    }

    /** Builds an outline that includes the transformed flyout background and triangle. */
    private void getOutline(Outline outline) {
        if (!mTriangleOutline.isEmpty()) {
        if (!mTriangleOutline.isEmpty() || !SHOW_POINTER) {
            // Draw the rect into the outline as a path so we can merge the triangle path into it.
            final Path rectPath = new Path();
            final float interpolatedRadius = getInterpolatedRadius();
@@ -503,7 +508,7 @@ public class BubbleFlyoutView extends FrameLayout {
            outline.setPath(rectPath);

            // Get rid of the triangle path once it has disappeared behind the flyout.
            if (mPercentStillFlyout > 0.5f) {
            if (SHOW_POINTER && mPercentStillFlyout > 0.5f) {
                outline.mPath.addPath(mTriangleOutline.mPath);
            }