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

Commit 52615f2e authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "[AnimatedAction] Refine the button UI to address feedback." into main

parents a4a9f18b 6955f631
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -2,16 +2,19 @@
    xmlns:android="http://schemas.android.com/apk/res/android"
    style="@android:style/Widget.Material.Button"
    android:layout_width="wrap_content"
    android:layout_height="@dimen/animated_action_button_touch_target_height"
    android:layout_height="match_parent"
    android:background="@drawable/animated_action_button_background"
    android:drawablePadding="@dimen/animated_action_button_drawable_padding"
    android:ellipsize="none"
    android:fontFamily="google-sans-flex-medium"
    android:ellipsize="end"
    android:fontFamily="google-sans-flex"
    android:fontWeight="500"
    android:gravity="center"
    android:minWidth="0dp"
    android:minHeight="@dimen/animated_action_button_touch_target_height"
    android:paddingHorizontal="@dimen/animated_action_button_padding_horizontal"
    android:paddingVertical="@dimen/animated_action_button_inset_vertical"
    android:paddingVertical="@dimen/animated_action_button_padding_vertical"
    android:stateListAnimator="@null"
    android:maxLines="2"
    android:textColor="@color/animated_action_button_text_color"
    android:textSize="@dimen/animated_action_button_font_size"
    android:textStyle="normal" />
+2 −1
Original line number Diff line number Diff line
@@ -1177,10 +1177,11 @@

    <!-- Animated Action params. -->
    <!-- Corner radius = half of min_height to create rounded sides. -->
    <dimen name="animated_action_button_corner_radius">16dp</dimen>
    <dimen name="animated_action_button_corner_radius">24dp</dimen>
    <dimen name="animated_action_button_icon_size">20dp</dimen>
    <dimen name="animated_action_button_outline_stroke_width">1dp</dimen>
    <dimen name="animated_action_button_padding_horizontal">12dp</dimen>
    <dimen name="animated_action_button_padding_vertical">14dp</dimen>
    <dimen name="animated_action_button_inset_vertical">8dp</dimen>
    <dimen name="animated_action_button_drawable_padding">8dp</dimen>
    <dimen name="animated_action_button_touch_target_height">48dp</dimen>
+11 −3
Original line number Diff line number Diff line
@@ -56,9 +56,17 @@ class BaseBackgroundDrawable(
    context: Context,
) : Drawable() {

    private val cornerRadius = context.resources.getDimension(R.dimen.animated_action_button_corner_radius)
    private val outlineStrokeWidth = context.resources.getDimension(R.dimen.animated_action_button_outline_stroke_width)
    private val insetVertical = 8 * context.resources.displayMetrics.density
    private val cornerRadius =
        context.resources.getDimensionPixelSize(R.dimen.animated_action_button_corner_radius)
            .toFloat()

    // Stroke is clipped in draw() callback, so doubled in width here.
    private val outlineStrokeWidth =
        2 * context.resources.getDimensionPixelSize(R.dimen.animated_action_button_outline_stroke_width)
            .toFloat()
    private val insetVertical =
        context.resources.getDimensionPixelSize(R.dimen.animated_action_button_inset_vertical)
            .toFloat()

    private val buttonShape = Path()
    // Color and style