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

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

[SB][Screen Chips] Don't require minWidth for the countdown chip.

We previously required all chips to have a minWidth for accessibility
since all chips were tappable. The countdown chip isn't tappable, so we
don't need to enforce that minWidth requirement for the countdown chip
(or for any non-tappable chip).

Bug: 353485675
Bug: 332662551
Flag: com.android.systemui.status_bar_screen_sharing_chips

Test: Start screen record -> verify countdown chip is smaller
Change-Id: Ifb1420e408432ed81c9f53b328d4d2882369c295
parent f647b94e
Loading
Loading
Loading
Loading
+16 −2
Original line number Diff line number Diff line
@@ -110,7 +110,7 @@ class CollapsedStatusBarViewBinderImpl @Inject constructor() : CollapsedStatusBa
                                    chipView.setOnClickListener(chipModel.onClickListener)

                                    // Accessibility
                                    setChipAccessibility(chipModel, chipView)
                                    setChipAccessibility(chipModel, chipView, chipBackgroundView)

                                    // Colors
                                    val textColor = chipModel.colors.text(chipContext)
@@ -213,7 +213,11 @@ class CollapsedStatusBarViewBinderImpl @Inject constructor() : CollapsedStatusBa
        this.setPaddingRelative(/* start= */ 0, paddingTop, paddingEnd, paddingBottom)
    }

    private fun setChipAccessibility(chipModel: OngoingActivityChipModel.Shown, chipView: View) {
    private fun setChipAccessibility(
        chipModel: OngoingActivityChipModel.Shown,
        chipView: View,
        chipBackgroundView: View,
    ) {
        when (chipModel) {
            is OngoingActivityChipModel.Shown.Countdown -> {
                // Set as assertive so talkback will announce the countdown
@@ -224,6 +228,16 @@ class CollapsedStatusBarViewBinderImpl @Inject constructor() : CollapsedStatusBa
                chipView.accessibilityLiveRegion = View.ACCESSIBILITY_LIVE_REGION_NONE
            }
        }
        // Clickable chips need to be a minimum size for accessibility purposes, but let
        // non-clickable chips be smaller.
        if (chipModel.onClickListener != null) {
            chipBackgroundView.minimumWidth =
                chipBackgroundView.context.resources.getDimensionPixelSize(
                    R.dimen.min_clickable_item_size
                )
        } else {
            chipBackgroundView.minimumWidth = 0
        }
    }

    private fun animateLightsOutView(view: View, visible: Boolean) {