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

Commit e32964be authored by Caitlin Shkuratov's avatar Caitlin Shkuratov
Browse files

[SB][Notif] Enforce max width constraints on status bar chips.

Put max widths on both the text version of the chip and the timeDelta
version of the chip. Also removes the side paddings so we can get more
room. This might not be 100% to spec but it's close enough for teamfood.

Bug: 364653005
Test: Manual, see b/364653005#comment46
Flag: com.android.systemui.status_bar_notification_chips
Change-Id: Ib24df4a0557c8bc7dfc205a13bf67670e9b964bf
parent 80e1b6b1
Loading
Loading
Loading
Loading
+5 −7
Original line number Diff line number Diff line
@@ -49,27 +49,25 @@
             ongoing_activity_chip_short_time_delta] will ever be shown at one time. -->

        <!-- Shows a timer, like 00:01. -->
        <!-- Don't use the LimitedWidth style for the timer because the end of the timer is often
             the most important value. ChipChronometer has the correct logic for when the timer is
             too large for the space allowed. -->
        <com.android.systemui.statusbar.chips.ui.view.ChipChronometer
            android:id="@+id/ongoing_activity_chip_time"
            style="@style/StatusBar.Chip.Text"
        />

        <!-- Shows generic text. -->
        <!-- Since there's so little room in the status bar chip area, don't ellipsize the text and
             instead just fade it out a bit at the end. -->
        <TextView
            android:id="@+id/ongoing_activity_chip_text"
            style="@style/StatusBar.Chip.Text"
            android:ellipsize="none"
            android:requiresFadingEdge="horizontal"
            android:fadingEdgeLength="@dimen/ongoing_activity_chip_text_fading_edge_length"
            style="@style/StatusBar.Chip.Text.LimitedWidth"
            android:visibility="gone"
            />

        <!-- Shows a time delta in short form, like "15min" or "1hr". -->
        <android.widget.DateTimeView
            android:id="@+id/ongoing_activity_chip_short_time_delta"
            style="@style/StatusBar.Chip.Text"
            style="@style/StatusBar.Chip.Text.LimitedWidth"
            android:visibility="gone"
            />

+1 −0
Original line number Diff line number Diff line
@@ -1760,6 +1760,7 @@
    <dimen name="wallet_button_vertical_padding">8dp</dimen>

    <!-- Ongoing activity chip -->
    <dimen name="ongoing_activity_chip_max_text_width">74dp</dimen>
    <!-- The activity chip side padding, used with the default phone icon. -->
    <dimen name="ongoing_activity_chip_side_padding">12dp</dimen>
    <!-- The activity chip side padding, used with an icon that has embedded padding (e.g. if the icon comes from the notification's smallIcon field). If the icon has padding, the chip itself can have less padding. -->
+10 −0
Original line number Diff line number Diff line
@@ -84,6 +84,16 @@
        <item name="android:textColor">?android:attr/colorPrimary</item>
    </style>

    <!-- Style for a status bar chip text that has a maximum width. Since there's so little room in
         the status bar chip area, don't ellipsize the text and instead just fade it out a bit at
         the end. -->
    <style name="StatusBar.Chip.Text.LimitedWidth">
        <item name="android:ellipsize">none</item>
        <item name="android:requiresFadingEdge">horizontal</item>
        <item name="android:fadingEdgeLength">@dimen/ongoing_activity_chip_text_fading_edge_length</item>
        <item name="android:maxWidth">@dimen/ongoing_activity_chip_max_text_width</item>
    </style>

    <style name="Chipbar" />

    <style name="Chipbar.Text" parent="@*android:style/TextAppearance.DeviceDefault.Notification.Title">
+7 −3
Original line number Diff line number Diff line
@@ -310,9 +310,13 @@ object OngoingActivityChipBinder {

    private fun View.setBackgroundPaddingForEmbeddedPaddingIcon() {
        val sidePadding =
            if (StatusBarNotifChips.isEnabled) {
                0
            } else {
                context.resources.getDimensionPixelSize(
                    R.dimen.ongoing_activity_chip_side_padding_for_embedded_padding_icon
                )
            }
        setPaddingRelative(sidePadding, paddingTop, sidePadding, paddingBottom)
    }