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

Commit 6955f631 authored by yyhua's avatar yyhua
Browse files

[AnimatedAction] Refine the button UI to address feedback.

Changes
- Update the font to use google-sans-flex with weight 500 for medium. Currently the font falls back to default font as "google-sans-flex-medium" unavailable.
- Update the stroke width. Currently the stroke is clipped in draw() callback, so doubled in width in the custom drawable.
- Other UI tweaks e.g. set max 2-lin, update corner radius and padding to adjust for 2 lines.

Next
- Add more tests in the follow-up cl

Bug: 383567383
Test: atest SmartActionScreenshotTest
Flag: com.android.systemui.notification_animated_actions_treatment
Change-Id: I2457ef51c53ee68ea00b91ed967de17608d1e843
parent d3af2e14
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
@@ -1167,10 +1167,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