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

Commit ba0ce077 authored by Liran Binyamin's avatar Liran Binyamin
Browse files

Fix bubbles manage button touch target

This change increases the touch area around the manage button, and also uses a dynamic height to scale with the text.

Before: https://screenshot.googleplex.com/9ySstyvcXtqQzwy
After: https://screenshot.googleplex.com/8gdjVkgqHvgosWY

Flag: NONE
Fixes: 308796727
Test: Manual
       - Create and expand bubble
       - Observe manage button height
       - Set font size to large
       - Observe manage button height updated
Change-Id: I610d448e08800864ecc735e7b7a6c230712faffa
parent 9e0426df
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -21,7 +21,7 @@
    <solid
        android:color="?androidprv:attr/materialColorSurfaceContainerHigh"
        />
    <corners android:radius="20dp" />
    <corners android:radius="18sp" />

    <padding
        android:left="20dp"
+5 −4
Original line number Diff line number Diff line
@@ -185,10 +185,11 @@
    <dimen name="bubble_pointer_overlap">1dp</dimen>
    <!-- Extra padding around the dismiss target for bubbles -->
    <dimen name="bubble_dismiss_slop">16dp</dimen>
    <!-- Height of button allowing users to adjust settings for bubbles. -->
    <dimen name="bubble_manage_button_height">36dp</dimen>
    <!-- Height of manage button including margins. -->
    <dimen name="bubble_manage_button_total_height">68dp</dimen>
    <!-- Height of button allowing users to adjust settings for bubbles. We use sp so that the
         button can scale with the font size. -->
    <dimen name="bubble_manage_button_height">36sp</dimen>
    <!-- Touch area height of the manage button. -->
    <dimen name="bubble_manage_button_touch_area_height">48dp</dimen>
    <!-- The margin around the outside of the manage button. -->
    <dimen name="bubble_manage_button_margin">16dp</dimen>
    <!-- Height of an item in the bubble manage menu. -->
+12 −0
Original line number Diff line number Diff line
@@ -57,6 +57,7 @@ import android.util.Log;
import android.util.TypedValue;
import android.view.ContextThemeWrapper;
import android.view.LayoutInflater;
import android.view.TouchDelegate;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewOutlineProvider;
@@ -470,6 +471,17 @@ public class BubbleExpandedView extends LinearLayout {
                    R.layout.bubble_manage_button, this /* parent */, false /* attach */);
            addView(mManageButton);
            mManageButton.setVisibility(visibility);
            post(() -> {
                int touchAreaHeight =
                        getResources().getDimensionPixelSize(
                                R.dimen.bubble_manage_button_touch_area_height);
                Rect r = new Rect();
                mManageButton.getHitRect(r);
                int extraTouchArea = (touchAreaHeight - r.height()) / 2;
                r.top -= extraTouchArea;
                r.bottom += extraTouchArea;
                setTouchDelegate(new TouchDelegate(r, mManageButton));
            });
        }
    }

+3 −2
Original line number Diff line number Diff line
@@ -198,9 +198,10 @@ public class BubblePositioner {
        mPointerHeight = res.getDimensionPixelSize(R.dimen.bubble_pointer_height);
        mPointerMargin = res.getDimensionPixelSize(R.dimen.bubble_pointer_margin);
        mPointerOverlap = res.getDimensionPixelSize(R.dimen.bubble_pointer_overlap);
        mManageButtonHeightIncludingMargins =
                res.getDimensionPixelSize(R.dimen.bubble_manage_button_total_height);
        mManageButtonHeight = res.getDimensionPixelSize(R.dimen.bubble_manage_button_height);
        mManageButtonHeightIncludingMargins =
                mManageButtonHeight
                + 2 * res.getDimensionPixelSize(R.dimen.bubble_manage_button_margin);
        mExpandedViewMinHeight = res.getDimensionPixelSize(R.dimen.bubble_expanded_default_height);
        mOverflowHeight = res.getDimensionPixelSize(R.dimen.bubble_overflow_height);
        mMinimumFlyoutWidthLargeScreen = res.getDimensionPixelSize(