compose: info: Apply tint color to title text instead

Restores previous behavior to attract attention to specific components

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
This commit is contained in:
Aayush Gupta
2025-11-09 19:30:07 +08:00
parent 972a2541bc
commit b3f2d3ed9c
4 changed files with 8 additions and 9 deletions

View File

@@ -12,7 +12,6 @@ import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Icon import androidx.compose.material3.Icon
import androidx.compose.material3.LocalContentColor
import androidx.compose.material3.MaterialTheme import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text import androidx.compose.material3.Text
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
@@ -38,7 +37,7 @@ import com.aurora.store.compose.preview.AppPreviewProvider
* @param title Title of the information * @param title Title of the information
* @param description Information to show * @param description Information to show
* @param painter Optional painter to draw the icon * @param painter Optional painter to draw the icon
* @param tint Optional tint color for the icon * @param titleColor Optional color for the title
* @param onClick Callback when this composable is clicked * @param onClick Callback when this composable is clicked
*/ */
@Composable @Composable
@@ -47,7 +46,7 @@ fun Info(
title: AnnotatedString, title: AnnotatedString,
description: AnnotatedString? = null, description: AnnotatedString? = null,
painter: Painter? = null, painter: Painter? = null,
tint: Color = LocalContentColor.current, titleColor: Color = Color.Unspecified,
onClick: (() -> Unit)? = null onClick: (() -> Unit)? = null
) { ) {
Row( Row(
@@ -61,13 +60,14 @@ fun Info(
horizontalArrangement = Arrangement.spacedBy(dimensionResource(R.dimen.margin_normal)), horizontalArrangement = Arrangement.spacedBy(dimensionResource(R.dimen.margin_normal)),
verticalAlignment = Alignment.CenterVertically verticalAlignment = Alignment.CenterVertically
) { ) {
if (painter != null) Icon(painter = painter, contentDescription = null, tint = tint) if (painter != null) Icon(painter = painter, contentDescription = null)
Column(modifier = Modifier.weight(1F)) { Column(modifier = Modifier.weight(1F)) {
Text( Text(
text = title, text = title,
style = MaterialTheme.typography.bodyMedium, style = MaterialTheme.typography.bodyMedium,
maxLines = 1, maxLines = 1,
overflow = TextOverflow.Ellipsis, overflow = TextOverflow.Ellipsis,
color = titleColor
) )
if (!description.isNullOrBlank()) { if (!description.isNullOrBlank()) {
Text( Text(

View File

@@ -7,5 +7,5 @@ package com.aurora.store.compose.theme
import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Color
val warningColor = Color(0xFFFFA000) // Amber val warningColor = Color(0xFFFF7600) // Amber
val successColor = Color(0xFF1B8738) // Green val successColor = Color(0xFF1B8738) // Green

View File

@@ -36,7 +36,7 @@ fun Compatibility(needsGms: Boolean, plexusScores: Scores? = null) {
if (!needsGms) { if (!needsGms) {
Info( Info(
painter = painterResource(R.drawable.ic_menu_about), painter = painterResource(R.drawable.ic_menu_about),
tint = successColor, titleColor = successColor,
title = AnnotatedString( title = AnnotatedString(
text = stringResource(R.string.details_compatibility_gms_not_required_title) text = stringResource(R.string.details_compatibility_gms_not_required_title)
), ),
@@ -51,7 +51,7 @@ fun Compatibility(needsGms: Boolean, plexusScores: Scores? = null) {
Info( Info(
painter = painterResource(R.drawable.ic_menu_about), painter = painterResource(R.drawable.ic_menu_about),
tint = warningColor, titleColor = warningColor,
title = AnnotatedString( title = AnnotatedString(
text = stringResource(R.string.details_compatibility_gms_required_title) text = stringResource(R.string.details_compatibility_gms_required_title)
), ),

View File

@@ -7,7 +7,6 @@ package com.aurora.store.compose.ui.details.components
import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Column
import androidx.compose.material3.LocalContentColor
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.ui.res.dimensionResource import androidx.compose.ui.res.dimensionResource
import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.painterResource
@@ -47,7 +46,7 @@ fun Privacy(report: Report?, onNavigateToDetailsExodus: (() -> Unit)? = null) {
Info( Info(
painter = painterResource(R.drawable.ic_visibility), painter = painterResource(R.drawable.ic_visibility),
tint = when { titleColor = when {
report != null && report.trackers.isEmpty() -> successColor report != null && report.trackers.isEmpty() -> successColor
else -> warningColor else -> warningColor
}, },