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

Commit 30be1d8a authored by Valentin Iftime's avatar Valentin Iftime
Browse files

Set FontWeight.ExtraBold for bundle header title

 If bold text adjustment is enabled, titleMediumEmphasized needs FontWeight.ExtraBold
    because titleMediumEmphasized is already bold.
 (this proabaly should be changed by Compose...)

Flag: EXEMPT bugfix

Test: manual

Bug: 425501135
Change-Id: Idf675072ce13f228ba5c579d3e4c4e283436f379
parent c4655419
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -43,12 +43,14 @@ import androidx.compose.ui.graphics.CompositingStrategy
import androidx.compose.ui.graphics.graphicsLayer
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.layout.Layout
import androidx.compose.ui.platform.LocalConfiguration
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.res.dimensionResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.semantics.clearAndSetSemantics
import androidx.compose.ui.semantics.contentDescription
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.constrainHeight
@@ -197,9 +199,17 @@ private fun ContentScope.BundleHeaderContent(
                    // Has to be a shared element because we may have a semi-transparent background
                    .element(NotificationRowPrimitives.Elements.NotificationIconBackground),
        )

        // Set FontWeight.ExtraBold if bold text adjustment is enabled
        // because titleMediumEmphasized is already bold
        val config = LocalConfiguration.current
        val isBoldTextEnabled = config.fontWeightAdjustment > 0
        Text(
            text = stringResource(viewModel.titleText),
            style = MaterialTheme.typography.titleMediumEmphasized,
            style =
                MaterialTheme.typography.titleMediumEmphasized.copy(
                    fontWeight = if (isBoldTextEnabled) FontWeight.ExtraBold else FontWeight.Bold
                ),
            color = MaterialTheme.colorScheme.primary,
            overflow = TextOverflow.Ellipsis,
            maxLines = 1,