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

Commit 680976e9 authored by yyhua's avatar yyhua
Browse files

[MagicAction] Created new layout for magic action button.

Note: Update the button shape, text color and font based on the latest spec of magic action.

Next
- Update the button animation

Bug: 383567383
Test: atest SmartActionScreenshotTest
Flag: com.android.systemui.notification_magic_actions_treatment
Change-Id: Ib36e8a18d7cab7030b58a2dd7a06057d06c62696
parent 03cab7ec
Loading
Loading
Loading
Loading
+21 −0
Original line number Original line Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>

<ripple xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
    android:color="@color/notification_ripple_untinted_color">
    <item>
        <inset
            android:insetBottom="8dp"
            android:insetLeft="0dp"
            android:insetRight="0dp"
            android:insetTop="8dp">
            <shape android:shape="rectangle">
                <corners android:radius="@dimen/magic_action_button_corner_radius" />
                <solid android:color="@androidprv:color/materialColorPrimaryContainer" />
                <stroke
                    android:width="@dimen/magic_action_button_outline_stroke_width"
                    android:color="@androidprv:color/materialColorOutlineVariant" />
            </shape>
        </inset>
    </item>
</ripple>
+15 −18
Original line number Original line Diff line number Diff line
<Button xmlns:android="http://schemas.android.com/apk/res/android"
<Button xmlns:android="http://schemas.android.com/apk/res/android"
    style="@android:style/Widget.Material.Button"
    style="@android:style/Widget.Material.Button"
        android:stateListAnimator="@null"
    android:layout_width="wrap_content"
    android:layout_width="wrap_content"
        android:layout_height="match_parent"
    android:layout_height="@dimen/magic_action_button_touch_target_height"
        android:minWidth="0dp"
    android:background="@drawable/magic_action_button_background"
        android:minHeight="@dimen/smart_reply_button_min_height"
    android:drawablePadding="@dimen/magic_action_button_drawable_padding"
        android:paddingVertical="@dimen/smart_reply_button_padding_vertical"
    android:ellipsize="none"
        android:background="@drawable/smart_reply_button_background"
    android:fontFamily="google-sans-flex"
    android:gravity="center"
    android:gravity="center"
        android:fontFamily="roboto-medium"
    android:minWidth="0dp"
        android:textSize="@dimen/smart_reply_button_font_size"
    android:paddingHorizontal="@dimen/magic_action_button_padding_horizontal"
        android:lineSpacingExtra="@dimen/smart_reply_button_line_spacing_extra"
    android:paddingVertical="@dimen/magic_action_button_inset_vertical"
        android:textColor="@color/smart_reply_button_text"
    android:stateListAnimator="@null"
        android:paddingStart="@dimen/smart_reply_button_action_padding_left"
    android:textColor="@color/magic_action_button_text_color"
        android:paddingEnd="@dimen/smart_reply_button_padding_horizontal"
    android:textSize="@dimen/magic_action_button_font_size"
        android:drawablePadding="@dimen/smart_action_button_icon_padding"
    android:textStyle="normal" />
        android:textStyle="normal"
        android:ellipsize="none"/>
+3 −0
Original line number Original line Diff line number Diff line
@@ -145,6 +145,9 @@
    <color name="smart_reply_button_background">#ffffffff</color>
    <color name="smart_reply_button_background">#ffffffff</color>
    <color name="smart_reply_button_stroke">@*android:color/accent_device_default</color>
    <color name="smart_reply_button_stroke">@*android:color/accent_device_default</color>


    <!-- Magic Action colors -->
    <color name="magic_action_button_text_color">@androidprv:color/materialColorOnSurfaceVariant</color>

    <!-- Biometric dialog colors -->
    <!-- Biometric dialog colors -->
    <color name="biometric_dialog_gray">#ff757575</color>
    <color name="biometric_dialog_gray">#ff757575</color>
    <color name="biometric_dialog_accent">@color/material_dynamic_primary40</color>
    <color name="biometric_dialog_accent">@color/material_dynamic_primary40</color>
+11 −0
Original line number Original line Diff line number Diff line
@@ -1131,6 +1131,17 @@
    <dimen name="smart_action_button_icon_padding">8dp</dimen>
    <dimen name="smart_action_button_icon_padding">8dp</dimen>
    <dimen name="smart_action_button_outline_stroke_width">2dp</dimen>
    <dimen name="smart_action_button_outline_stroke_width">2dp</dimen>


    <!-- Magic Action params. -->
    <!-- Corner radius = half of min_height to create rounded sides. -->
    <dimen name="magic_action_button_corner_radius">16dp</dimen>
    <dimen name="magic_action_button_icon_size">20dp</dimen>
    <dimen name="magic_action_button_outline_stroke_width">1dp</dimen>
    <dimen name="magic_action_button_padding_horizontal">12dp</dimen>
    <dimen name="magic_action_button_inset_vertical">8dp</dimen>
    <dimen name="magic_action_button_drawable_padding">8dp</dimen>
    <dimen name="magic_action_button_touch_target_height">48dp</dimen>
    <dimen name="magic_action_button_font_size">12sp</dimen>

    <!-- A reasonable upper bound for the height of the smart reply button. The measuring code
    <!-- A reasonable upper bound for the height of the smart reply button. The measuring code
            needs to start with a guess for the maximum size. Currently two-line smart reply buttons
            needs to start with a guess for the maximum size. Currently two-line smart reply buttons
            add about 88dp of height to the notifications. -->
            add about 88dp of height to the notifications. -->
+0 −10
Original line number Original line Diff line number Diff line
@@ -409,16 +409,6 @@ constructor(
                as Button)
                as Button)
            .apply {
            .apply {
                text = action.title
                text = action.title
                // TODO: Move the MagicActionBackgroundDrawable to MagicActionButton once
                //  MagicActionButton is created.
                if (isMagicAction) {
                    background = MagicActionBackgroundDrawable(parent.context)
                    val textColor =
                        parent.context.getColor(
                            com.android.internal.R.color.materialColorOnPrimaryContainer
                        )
                    setTextColor(textColor)
                }


                // We received the Icon from the application - so use the Context of the application
                // We received the Icon from the application - so use the Context of the application
                // to
                // to