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

Commit 102431d5 authored by Petr Cermak's avatar Petr Cermak
Browse files

Custom SmartReplyView layout

Implement SmartReplyView#onMeasure and SmartReplyView#onLayout according
to the redlines in go/p-notifications:

  * Smart reply buttons can have at most 2 lines of text.
  * Squeeze buttons to 2 lines of text when necessary to fit more
    buttons.
  * Don't show buttons which have more than 2 lines of text or don't fit
    within the notification width.
  * Update button background and text color.

Screenshot: https://screenshot.googleplex.com/cSM6Ve7qjb3.png

Bug: 67765414
Test: atest SmartReplyViewTest
Change-Id: Ia161c7f5669e7aef1b8c3480a8836784f0bde055
parent 1cfc06a1
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -20,7 +20,9 @@
        android:color="@color/notification_ripple_untinted_color">
    <item>
        <shape android:shape="rectangle">
            <corners android:radius="@dimen/smart_reply_button_corner_radius"/>
            <!-- Use non-zero corner radius to work around b/73285195. The actual corner radius is
                 set dynamically at runtime in SmartReplyView. -->
            <corners android:radius="1dp"/>
            <solid android:color="@color/smart_reply_button_background"/>
        </shape>
    </item>
+6 −4
Original line number Diff line number Diff line
@@ -16,17 +16,19 @@
  ~ limitations under the License
  -->

<!-- android:paddingHorizontal is set dynamically in SmartReplyView. -->
<Button xmlns:android="http://schemas.android.com/apk/res/android"
        style="@android:style/Widget.Material.Button.Borderless.Small"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="@dimen/smart_reply_button_spacing"
        android:layout_height="match_parent"
        android:minWidth="0dp"
        android:minHeight="@dimen/smart_reply_button_min_height"
        android:paddingVertical="@dimen/smart_reply_button_padding_vertical"
        android:paddingHorizontal="@dimen/smart_reply_button_corner_radius"
        android:background="@drawable/smart_reply_button_background"
        android:gravity="center"
        android:fontFamily="sans-serif"
        android:textSize="@dimen/smart_reply_button_font_size"
        android:lineSpacingExtra="@dimen/smart_reply_button_line_spacing_extra"
        android:textColor="@color/smart_reply_button_text"
        android:textStyle="normal"
        android:singleLine="true"/>
 No newline at end of file
        android:ellipsize="none"/>
 No newline at end of file
+4 −1
Original line number Diff line number Diff line
@@ -19,9 +19,12 @@
<!-- LinearLayout -->
<com.android.systemui.statusbar.policy.SmartReplyView
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:systemui="http://schemas.android.com/apk/res-auto"
    android:id="@+id/smart_reply_view"
    android:layout_height="wrap_content"
    android:layout_width="wrap_content"
    android:layout_gravity="end">
    systemui:spacing="@dimen/smart_reply_button_spacing"
    systemui:singleLineButtonPaddingHorizontal="@dimen/smart_reply_button_padding_horizontal_single_line"
    systemui:doubleLineButtonPaddingHorizontal="@dimen/smart_reply_button_padding_horizontal_double_line">
    <!-- smart_reply_button(s) will be added here. -->
</com.android.systemui.statusbar.policy.SmartReplyView>
 No newline at end of file
+6 −0
Original line number Diff line number Diff line
@@ -130,5 +130,11 @@
    <attr name="darkIconTheme" format="reference" />
    <attr name="wallpaperTextColor" format="reference|color" />
    <attr name="wallpaperTextColorSecondary" format="reference|color" />

    <declare-styleable name="SmartReplyView">
        <attr name="spacing" format="dimension" />
        <attr name="singleLineButtonPaddingHorizontal" format="dimension" />
        <attr name="doubleLineButtonPaddingHorizontal" format="dimension" />
    </declare-styleable>
</resources>
+2 −3
Original line number Diff line number Diff line
@@ -156,9 +156,8 @@

    <color name="zen_introduction">#ffffffff</color>


    <color name="smart_reply_button_text">#ff4285f4</color><!-- blue 500 -->
    <color name="smart_reply_button_background">#fff7f7f7</color>
    <color name="smart_reply_button_text">#de000000</color> <!-- 87% black -->
    <color name="smart_reply_button_background">#fff2f2f2</color>

    <!-- Fingerprint dialog colors -->
    <color name="fingerprint_dialog_bg_color">#f4ffffff</color> <!-- 96% white -->
Loading