compose: Tint info icon on trackers or compatibility issues
Use amber color to attract user's attention towards the issue Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
This commit is contained in:
@@ -12,11 +12,13 @@ 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
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.graphics.Color
|
||||||
import androidx.compose.ui.graphics.painter.Painter
|
import androidx.compose.ui.graphics.painter.Painter
|
||||||
import androidx.compose.ui.res.dimensionResource
|
import androidx.compose.ui.res.dimensionResource
|
||||||
import androidx.compose.ui.res.painterResource
|
import androidx.compose.ui.res.painterResource
|
||||||
@@ -36,6 +38,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 onClick Callback when this composable is clicked
|
* @param onClick Callback when this composable is clicked
|
||||||
*/
|
*/
|
||||||
@Composable
|
@Composable
|
||||||
@@ -44,6 +47,7 @@ fun Info(
|
|||||||
title: AnnotatedString,
|
title: AnnotatedString,
|
||||||
description: AnnotatedString? = null,
|
description: AnnotatedString? = null,
|
||||||
painter: Painter? = null,
|
painter: Painter? = null,
|
||||||
|
tint: Color = LocalContentColor.current,
|
||||||
onClick: (() -> Unit)? = null
|
onClick: (() -> Unit)? = null
|
||||||
) {
|
) {
|
||||||
Row(
|
Row(
|
||||||
@@ -57,7 +61,7 @@ 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)
|
if (painter != null) Icon(painter = painter, contentDescription = null, tint = tint)
|
||||||
Column(modifier = Modifier.weight(1F)) {
|
Column(modifier = Modifier.weight(1F)) {
|
||||||
Text(
|
Text(
|
||||||
text = title,
|
text = title,
|
||||||
|
|||||||
10
app/src/main/java/com/aurora/store/compose/theme/Color.kt
Normal file
10
app/src/main/java/com/aurora/store/compose/theme/Color.kt
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: 2025 The Calyx Institute
|
||||||
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.aurora.store.compose.theme
|
||||||
|
|
||||||
|
import androidx.compose.ui.graphics.Color
|
||||||
|
|
||||||
|
val warningColor = Color(0xFFFFA000) // Amber
|
||||||
@@ -16,6 +16,7 @@ import androidx.compose.ui.tooling.preview.Preview
|
|||||||
import com.aurora.store.R
|
import com.aurora.store.R
|
||||||
import com.aurora.store.compose.composable.Header
|
import com.aurora.store.compose.composable.Header
|
||||||
import com.aurora.store.compose.composable.Info
|
import com.aurora.store.compose.composable.Info
|
||||||
|
import com.aurora.store.compose.theme.warningColor
|
||||||
import com.aurora.store.data.model.Scores
|
import com.aurora.store.data.model.Scores
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -48,6 +49,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,
|
||||||
title = AnnotatedString(
|
title = AnnotatedString(
|
||||||
text = stringResource(R.string.details_compatibility_gms_required_title)
|
text = stringResource(R.string.details_compatibility_gms_required_title)
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ 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
|
||||||
@@ -16,6 +17,7 @@ import androidx.compose.ui.tooling.preview.Preview
|
|||||||
import com.aurora.store.R
|
import com.aurora.store.R
|
||||||
import com.aurora.store.compose.composable.Header
|
import com.aurora.store.compose.composable.Header
|
||||||
import com.aurora.store.compose.composable.Info
|
import com.aurora.store.compose.composable.Info
|
||||||
|
import com.aurora.store.compose.theme.warningColor
|
||||||
import com.aurora.store.data.model.Report
|
import com.aurora.store.data.model.Report
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -44,6 +46,10 @@ fun Privacy(report: Report?, onNavigateToDetailsExodus: (() -> Unit)? = null) {
|
|||||||
|
|
||||||
Info(
|
Info(
|
||||||
painter = painterResource(R.drawable.ic_visibility),
|
painter = painterResource(R.drawable.ic_visibility),
|
||||||
|
tint = when {
|
||||||
|
report != null && report.trackers.isEmpty() -> LocalContentColor.current
|
||||||
|
else -> warningColor
|
||||||
|
},
|
||||||
title = AnnotatedString(text = reportStatus),
|
title = AnnotatedString(text = reportStatus),
|
||||||
description = AnnotatedString(text = stringResource(R.string.exodus_tracker_desc))
|
description = AnnotatedString(text = stringResource(R.string.exodus_tracker_desc))
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user