commit 79620816f8617348fd9fabe59c3bf4d5e0d974ae
parent 4f1f0c9e05126bd15531b28bf99cae2946e9ae29
Author: Gabriel Luong <gabriel.luong@gmail.com>
Date: Thu, 20 Nov 2025 08:12:39 +0000
Bug 1998092 - Part 16: Migrate CookieBannerItem to use M3 Acorn color tokens r=android-reviewers,007
- This is part of the old trust panel UI that is slated for removal at some point. The emphasis is solely on migrating the color tokens to M3.
Differential Revision: https://phabricator.services.mozilla.com/D273041
Diffstat:
1 file changed, 46 insertions(+), 48 deletions(-)
diff --git a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/settings/quicksettings/protections/ProtectionsView.kt b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/settings/quicksettings/protections/ProtectionsView.kt
@@ -8,16 +8,16 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.annotation.VisibleForTesting
-import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.interaction.MutableInteractionSource
-import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.defaultMinSize
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.material3.Icon
+import androidx.compose.material3.MaterialTheme
+import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
@@ -37,6 +37,7 @@ import org.mozilla.fenix.trackingprotection.CookieBannerUIMode.REQUEST_UNSUPPORT
import org.mozilla.fenix.trackingprotection.CookieBannerUIMode.SITE_NOT_SUPPORTED
import org.mozilla.fenix.trackingprotection.ProtectionsState
import org.mozilla.fenix.utils.Settings
+import mozilla.components.ui.icons.R as iconsR
/**
* MVI View that displays the tracking protection, cookie banner handling toggles and the navigation
@@ -123,7 +124,7 @@ class ProtectionsView(
CookieBannerItem(
label = label,
cookieBannerUIMode = cookieBannerMode,
- endIconPainter = painterResource(R.drawable.ic_arrowhead_right),
+ endIconPainter = painterResource(iconsR.drawable.mozac_ic_chevron_right_24),
onClick = { interactor.onCookieBannerHandlingDetailsClicked() },
)
}
@@ -155,48 +156,47 @@ private fun CookieBannerItem(
)
}
- Row(
- modifier = rowModifier,
- verticalAlignment = Alignment.CenterVertically,
- ) {
- cookieBannerUIMode.icon?.let {
- Icon(
- painter = painterResource(it),
- contentDescription = null,
- modifier = Modifier.padding(horizontal = 0.dp),
- tint = FirefoxTheme.colors.iconPrimary,
- )
- }
-
- Column(
- modifier = Modifier
- .padding(horizontal = 8.dp, vertical = 6.dp)
- .weight(1f),
+ Surface {
+ Row(
+ modifier = rowModifier,
+ verticalAlignment = Alignment.CenterVertically,
) {
- Text(
- text = label,
- color = FirefoxTheme.colors.textPrimary,
- style = FirefoxTheme.typography.subtitle1,
- maxLines = 1,
- )
- cookieBannerUIMode.description?.let {
+ cookieBannerUIMode.icon?.let {
+ Icon(
+ painter = painterResource(it),
+ contentDescription = null,
+ modifier = Modifier.padding(horizontal = 0.dp),
+ )
+ }
+
+ Column(
+ modifier = Modifier
+ .padding(horizontal = 8.dp, vertical = 6.dp)
+ .weight(1f),
+ ) {
Text(
- text = stringResource(it),
- color = FirefoxTheme.colors.textSecondary,
- style = FirefoxTheme.typography.body2,
+ text = label,
+ style = FirefoxTheme.typography.subtitle1,
maxLines = 1,
)
+ cookieBannerUIMode.description?.let {
+ Text(
+ text = stringResource(it),
+ color = MaterialTheme.colorScheme.onSurfaceVariant,
+ style = FirefoxTheme.typography.body2,
+ maxLines = 1,
+ )
+ }
+ }
+ endIconPainter?.let {
+ Icon(
+ modifier = Modifier
+ .padding(end = 0.dp)
+ .size(24.dp),
+ painter = it,
+ contentDescription = null,
+ )
}
- }
- endIconPainter?.let {
- Icon(
- modifier = Modifier
- .padding(end = 0.dp)
- .size(24.dp),
- painter = it,
- contentDescription = null,
- tint = FirefoxTheme.colors.iconPrimary,
- )
}
}
}
@@ -205,13 +205,11 @@ private fun CookieBannerItem(
@PreviewLightDark
private fun CookieBannerItemPreview() {
FirefoxTheme {
- Box(Modifier.background(FirefoxTheme.colors.layer1)) {
- CookieBannerItem(
- label = "Cookie Banner Reduction",
- cookieBannerUIMode = CookieBannerUIMode.ENABLE,
- endIconPainter = painterResource(R.drawable.ic_arrowhead_right),
- onClick = { println("list item click") },
- )
- }
+ CookieBannerItem(
+ label = "Cookie Banner Reduction",
+ cookieBannerUIMode = CookieBannerUIMode.ENABLE,
+ endIconPainter = painterResource(iconsR.drawable.mozac_ic_chevron_right_24),
+ onClick = { println("list item click") },
+ )
}
}