commit b6f028ef74091acc3e1938de4e6ec63f25c2033b
parent e939cbb6ebedcdc1599dab5b82ad5ae41b1c3b4f
Author: Gabriel Luong <gabriel.luong@gmail.com>
Date: Thu, 20 Nov 2025 18:36:58 +0000
Bug 1998092 - Part 8: Migrate InfoScreen to M3 Acorn specs r=android-reviewers,007
- Following the typography and color scheme used for LinkText for the text used in InfoScreen.
Differential Revision: https://phabricator.services.mozilla.com/D272103
Diffstat:
1 file changed, 66 insertions(+), 53 deletions(-)
diff --git a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/settings/doh/info/InfoScreen.kt b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/settings/doh/info/InfoScreen.kt
@@ -5,19 +5,22 @@
package org.mozilla.fenix.settings.doh.info
import androidx.annotation.StringRes
-import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
+import androidx.compose.material3.LocalContentColor
import androidx.compose.material3.MaterialTheme
+import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
+import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.style.TextDecoration
+import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import mozilla.components.compose.base.annotation.FlexibleWindowLightDarkPreview
import org.mozilla.fenix.R
@@ -25,6 +28,7 @@ import org.mozilla.fenix.compose.LinkText
import org.mozilla.fenix.compose.LinkTextState
import org.mozilla.fenix.settings.SupportUtils
import org.mozilla.fenix.theme.FirefoxTheme
+import org.mozilla.fenix.theme.Theme
/**
* Composable function that displays the info screen of DoH settings.
@@ -55,24 +59,24 @@ internal fun InfoScreen(
bulletText to sumoTopic
}
- Column(
- modifier = Modifier
- .fillMaxSize()
- .background(FirefoxTheme.colors.layer1),
- ) {
- Title(
- title = title,
- )
+ Surface {
+ Column(
+ modifier = Modifier.fillMaxSize(),
+ ) {
+ Title(
+ title = title,
+ )
- bulletPoints.forEach { (text, url) ->
- val learnMoreUrl = url?.let {
- SupportUtils.getGenericSumoURLForTopic(it)
+ bulletPoints.forEach { (text, url) ->
+ val learnMoreUrl = url?.let {
+ SupportUtils.getGenericSumoURLForTopic(it)
+ }
+ BulletTextWithOptionalLink(
+ text = text,
+ learnMoreUrl = learnMoreUrl,
+ onLearnMoreClicked = onLearnMoreClicked,
+ )
}
- BulletTextWithOptionalLink(
- text = text,
- learnMoreUrl = learnMoreUrl,
- onLearnMoreClicked = onLearnMoreClicked,
- )
}
}
}
@@ -92,7 +96,7 @@ private fun Title(
) {
Text(
text = title,
- color = MaterialTheme.colorScheme.tertiary,
+ color = MaterialTheme.colorScheme.onSurfaceVariant,
style = FirefoxTheme.typography.headline8,
)
}
@@ -104,8 +108,8 @@ private fun BulletTextWithOptionalLink(
onLearnMoreClicked: (String) -> Unit,
modifier: Modifier = Modifier,
learnMoreUrl: String? = null,
- color: Color = FirefoxTheme.colors.textPrimary,
- style: TextStyle = FirefoxTheme.typography.subtitle1,
+ color: Color = MaterialTheme.colorScheme.onSurfaceVariant,
+ style: TextStyle = FirefoxTheme.typography.body2, // Follows the same TextStyle of LinkText
) {
Row(
modifier = modifier
@@ -116,47 +120,36 @@ private fun BulletTextWithOptionalLink(
bottom = 6.dp,
),
) {
- Text(
- text = "•",
- modifier = Modifier.padding(end = 8.dp),
- color = color,
- )
-
- if (learnMoreUrl == null) {
+ CompositionLocalProvider(LocalContentColor provides color) {
Text(
- text = text,
- color = color,
+ text = "•",
+ modifier = Modifier.padding(end = 8.dp),
style = style,
)
- } else {
- LinkText(
- text = text,
- linkTextStates = listOf(
- LinkTextState(
- text = stringResource(R.string.preference_doh_learn_more),
- url = learnMoreUrl,
- onClick = { onLearnMoreClicked(it) },
+
+ if (learnMoreUrl == null) {
+ Text(
+ text = text,
+ style = style,
+ )
+ } else {
+ LinkText(
+ text = text,
+ linkTextStates = listOf(
+ LinkTextState(
+ text = stringResource(R.string.preference_doh_learn_more),
+ url = learnMoreUrl,
+ onClick = { onLearnMoreClicked(it) },
+ ),
),
- ),
- linkTextDecoration = TextDecoration.Underline,
- style = style.copy(
- color = color,
- ),
- )
+ linkTextDecoration = TextDecoration.Underline,
+ style = style,
+ )
+ }
}
}
}
-@Composable
-@FlexibleWindowLightDarkPreview
-private fun InfoScreenPreview() {
- FirefoxTheme {
- InfoScreen(
- infoScreenTopic = InfoScreenTopic.DEFAULT,
- )
- }
-}
-
/**
* Holds the resource for each bullet line, plus any string resource IDs
* that you want to use as placeholders.
@@ -213,3 +206,23 @@ internal enum class InfoScreenTopic(
),
),
}
+
+@Composable
+@FlexibleWindowLightDarkPreview
+private fun InfoScreenPreview() {
+ FirefoxTheme {
+ InfoScreen(
+ infoScreenTopic = InfoScreenTopic.DEFAULT,
+ )
+ }
+}
+
+@Composable
+@Preview
+private fun InfoScreenPrivatePreview() {
+ FirefoxTheme(theme = Theme.Private) {
+ InfoScreen(
+ infoScreenTopic = InfoScreenTopic.DEFAULT,
+ )
+ }
+}