tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit f8db430e3d15e9fd032a3ce810c74cb319441ffb
parent 3afefb638f6ad0f87275a0ca99137a974deb71ee
Author: Gabriel Luong <gabriel.luong@gmail.com>
Date:   Sun, 23 Nov 2025 06:48:28 +0000

Bug 1993368 - Part 16: Migrate MicrosurveyRequestPrompt to use M3 Acorn color tokens r=android-reviewers,007

Differential Revision: https://phabricator.services.mozilla.com/D271130

Diffstat:
Mmobile/android/fenix/app/src/main/java/org/mozilla/fenix/microsurvey/ui/MicrosurveyRequestPrompt.kt | 76++++++++++++++++++++++++++++++++++++++++++++++++----------------------------
1 file changed, 48 insertions(+), 28 deletions(-)

diff --git a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/microsurvey/ui/MicrosurveyRequestPrompt.kt b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/microsurvey/ui/MicrosurveyRequestPrompt.kt @@ -8,7 +8,6 @@ import androidx.compose.animation.AnimatedVisibility import androidx.compose.animation.slideInVertically import androidx.compose.animation.slideOutVertically import androidx.compose.foundation.Image -import androidx.compose.foundation.background import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer @@ -18,7 +17,7 @@ import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.width import androidx.compose.material3.Icon -import androidx.compose.material3.IconButton +import androidx.compose.material3.Surface import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue @@ -29,15 +28,18 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource +import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import mozilla.components.compose.base.annotation.FlexibleWindowLightDarkPreview import mozilla.components.compose.base.button.FilledButton +import mozilla.components.compose.base.button.IconButton import org.mozilla.fenix.HomeActivity import org.mozilla.fenix.R import org.mozilla.fenix.compose.utils.KeyboardState import org.mozilla.fenix.compose.utils.keyboardAsState import org.mozilla.fenix.microsurvey.ui.ext.MicrosurveyUIData import org.mozilla.fenix.theme.FirefoxTheme +import org.mozilla.fenix.theme.Theme import mozilla.components.ui.icons.R as iconsR private const val TABLET_WIDTH_FRACTION = 0.5f @@ -68,32 +70,32 @@ fun MicrosurveyRequestPrompt( enter = slideInVertically(initialOffsetY = { it }), exit = slideOutVertically(targetOffsetY = { it }), ) { - Column( - horizontalAlignment = Alignment.CenterHorizontally, - modifier = Modifier - .fillMaxWidth() - .background(color = FirefoxTheme.colors.layer1), - ) { + Surface { Column( - modifier = Modifier - .padding(all = 16.dp) - .fillMaxWidth( - if (FirefoxTheme.windowSize.isNotSmall()) { - TABLET_WIDTH_FRACTION - } else { - NON_TABLET_WIDTH_FRACTION - }, - ), + horizontalAlignment = Alignment.CenterHorizontally, + modifier = Modifier.fillMaxWidth(), ) { - Header(microsurvey.promptTitle) { onCloseButtonClicked() } + Column( + modifier = Modifier + .padding(all = 16.dp) + .fillMaxWidth( + if (FirefoxTheme.windowSize.isNotSmall()) { + TABLET_WIDTH_FRACTION + } else { + NON_TABLET_WIDTH_FRACTION + }, + ), + ) { + Header(microsurvey.promptTitle) { onCloseButtonClicked() } - Spacer(modifier = Modifier.height(8.dp)) + Spacer(modifier = Modifier.height(8.dp)) - FilledButton( - text = stringResource(id = R.string.micro_survey_continue_button_label), - modifier = Modifier.fillMaxWidth(), - ) { - onStartSurveyClicked() + FilledButton( + text = stringResource(id = R.string.micro_survey_continue_button_label), + modifier = Modifier.fillMaxWidth(), + ) { + onStartSurveyClicked() + } } } } @@ -117,18 +119,17 @@ private fun Header( Text( text = title, style = FirefoxTheme.typography.headline7, - color = FirefoxTheme.colors.textPrimary, modifier = Modifier.weight(1f), ) IconButton( onClick = { onCloseButtonClicked() }, + contentDescription = stringResource(id = R.string.microsurvey_close_button_content_description), modifier = Modifier.size(20.dp), ) { Icon( - painter = painterResource(id = R.drawable.ic_close), - contentDescription = stringResource(id = R.string.microsurvey_close_button_content_description), - tint = FirefoxTheme.colors.iconPrimary, + painter = painterResource(id = iconsR.drawable.mozac_ic_cross_20), + contentDescription = null, ) } } @@ -152,3 +153,22 @@ private fun MicrosurveyRequestPromptPreview() { ) } } + +@Preview +@Composable +private fun MicrosurveyRequestPromptPrivatePreview() { + FirefoxTheme(theme = Theme.Private) { + MicrosurveyRequestPrompt( + microsurvey = MicrosurveyUIData( + id = "", + promptTitle = "Help make printing in Firefox better. It only takes a sec.", + icon = iconsR.drawable.mozac_ic_lightbulb_24, + question = "", + answers = emptyList(), + ), + activity = HomeActivity(), + onStartSurveyClicked = {}, + onCloseButtonClicked = {}, + ) + } +}