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

Commit 96b5ce2f authored by Caitlin Shkuratov's avatar Caitlin Shkuratov
Browse files

[SB][Chips] Update font in chips to Label.Large.Emphasized.

Fixes: 393616099
Bug: 364653005
Flag: com.android.systemui.status_bar_notification_chips
Test: Trigger chip timer, chip text, and chip short time delta -> verify
all show the updated font. Verify with ChipsModernization both off and
on

Change-Id: I9b69ce8a23e953b2c696fbf66ebd7b19dbbea405
parent bc85e45d
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.systemui.statusbar.chips.ui.binder
import android.annotation.IdRes
import android.content.Context
import android.content.res.ColorStateList
import android.graphics.Typeface
import android.graphics.drawable.GradientDrawable
import android.view.View
import android.view.ViewGroup
@@ -27,6 +28,7 @@ import android.widget.FrameLayout
import android.widget.ImageView
import android.widget.TextView
import androidx.annotation.UiThread
import com.android.systemui.FontStyles
import com.android.systemui.common.shared.model.ContentDescription
import com.android.systemui.common.ui.binder.ContentDescriptionViewBinder
import com.android.systemui.common.ui.binder.IconViewBinder
@@ -170,6 +172,16 @@ object OngoingActivityChipBinder {
        forceLayout()
    }

    /** Updates the typefaces for any text shown in the chip. */
    fun updateTypefaces(binding: OngoingActivityChipViewBinding) {
        binding.timeView.typeface =
            Typeface.create(FontStyles.GSF_LABEL_LARGE_EMPHASIZED, Typeface.NORMAL)
        binding.textView.typeface =
            Typeface.create(FontStyles.GSF_LABEL_LARGE_EMPHASIZED, Typeface.NORMAL)
        binding.shortTimeDeltaView.typeface =
            Typeface.create(FontStyles.GSF_LABEL_LARGE_EMPHASIZED, Typeface.NORMAL)
    }

    private fun setChipIcon(
        chipModel: OngoingActivityChipModel.Active,
        backgroundView: ChipBackgroundContainer,
+3 −1
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.systemui.statusbar.chips.ui.compose

import androidx.compose.material3.ExperimentalMaterial3ExpressiveApi
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
@@ -42,6 +43,7 @@ import com.android.systemui.statusbar.chips.ui.viewmodel.rememberChronometerStat
import com.android.systemui.statusbar.chips.ui.viewmodel.rememberTimeRemainingState
import kotlin.math.min

@OptIn(ExperimentalMaterial3ExpressiveApi::class)
@Composable
fun ChipContent(viewModel: OngoingActivityChipModel.Active, modifier: Modifier = Modifier) {
    val context = LocalContext.current
@@ -49,7 +51,7 @@ fun ChipContent(viewModel: OngoingActivityChipModel.Active, modifier: Modifier =
    val hasEmbeddedIcon =
        viewModel.icon is OngoingActivityChipModel.ChipIcon.StatusBarView ||
            viewModel.icon is OngoingActivityChipModel.ChipIcon.StatusBarNotificationIcon
    val textStyle = MaterialTheme.typography.labelLarge
    val textStyle = MaterialTheme.typography.labelLargeEmphasized
    val textColor = Color(viewModel.colors.text(context))
    val maxTextWidth = dimensionResource(id = R.dimen.ongoing_activity_chip_max_text_width)
    val startPadding =
+2 −0
Original line number Diff line number Diff line
@@ -198,6 +198,8 @@ constructor(
                        OngoingActivityChipBinder.createBinding(
                            view.requireViewById(R.id.ongoing_activity_chip_secondary)
                        )
                    OngoingActivityChipBinder.updateTypefaces(primaryChipViewBinding)
                    OngoingActivityChipBinder.updateTypefaces(secondaryChipViewBinding)
                    launch {
                        viewModel.ongoingActivityChipsLegacy.collectLatest { chips ->
                            OngoingActivityChipBinder.bind(