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

Commit 2fbc08a2 authored by Chris Göllner's avatar Chris Göllner Committed by Chris Göllner
Browse files

Also add embedded padding when icon is StatusBarNotificationIcon

StatusBarNotificationIcon will later be used to instantiate a
StatusBarIconView, which requires embedded padding.

Fixes: 384695757
Bug: 386372350
Flag: com.android.systemui.status_bar_connected_displays
Test: Manual - See before and after screenshots
Change-Id: I19adff13085549505eaf66f7adb9074b0604371e
parent 834f96f5
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -252,8 +252,9 @@ object OngoingActivityChipBinder {
        chipTimeView: ChipChronometer,
        chipShortTimeDeltaView: DateTimeView,
    ) {
        if (chipModel.icon != null) {
            if (chipModel.icon is OngoingActivityChipModel.ChipIcon.StatusBarView) {
        val icon = chipModel.icon
        if (icon != null) {
            if (iconRequiresEmbeddedPadding(icon)) {
                // If the icon is a custom [StatusBarIconView], then it should've come from
                // `Notification.smallIcon`, which is required to embed its own paddings. We need to
                // adjust the other paddings to make everything look good :)
@@ -275,6 +276,10 @@ object OngoingActivityChipBinder {
        }
    }

    private fun iconRequiresEmbeddedPadding(icon: OngoingActivityChipModel.ChipIcon) =
        icon is OngoingActivityChipModel.ChipIcon.StatusBarView ||
            icon is OngoingActivityChipModel.ChipIcon.StatusBarNotificationIcon

    private fun View.setTextPaddingForEmbeddedPaddingIcon() {
        val newPaddingEnd =
            context.resources.getDimensionPixelSize(