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

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

[SB][Chips] Update notif icon color in chip whenever theme changes.

The Chip Composable will be re-composed when the theme changes, we just
need to re-calculate the icon color and re-set the value on the
StatusBarIconView when that happens.

Fixes: 397500380
Bug: 372657935
Flag: com.android.systemui.status_bar_chips_modernization
Test: Trigger notification chip then change theme -> verify icon color
also changes
Test: Trigger call chip then change theme -> verify icon color also
changes
Test: Trigger screen record chip then change theme -> verify icon &
background colors stay the same

Change-Id: I3f75a95b9d086fbd79a0c59df2eabb436b659afc
parent 3407c387
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -228,6 +228,7 @@ private fun StatusBarIcon(
    iconFactory: () -> StatusBarIconView?,
    iconFactory: () -> StatusBarIconView?,
) {
) {
    val context = LocalContext.current
    val context = LocalContext.current
    val colorTintList = ColorStateList.valueOf(colors.text(context))


    val iconSizePx =
    val iconSizePx =
        context.resources.getDimensionPixelSize(
        context.resources.getDimensionPixelSize(
@@ -238,9 +239,9 @@ private fun StatusBarIcon(
        factory = { _ ->
        factory = { _ ->
            iconFactory.invoke()?.apply {
            iconFactory.invoke()?.apply {
                layoutParams = ViewGroup.LayoutParams(iconSizePx, iconSizePx)
                layoutParams = ViewGroup.LayoutParams(iconSizePx, iconSizePx)
                imageTintList = ColorStateList.valueOf(colors.text(context))
            } ?: throw IllegalStateException("Missing StatusBarIconView for $notificationKey")
            } ?: throw IllegalStateException("Missing StatusBarIconView for $notificationKey")
        },
        },
        update = { iconView -> iconView.imageTintList = colorTintList },
    )
    )
}
}