commit a712e9d7dc8d667e25b3dfadf27faca93b212910
parent 1c8ca0b04ccab5c79d0bcfaa2f734abba920eff7
Author: Gabriel Luong <gabriel.luong@gmail.com>
Date: Thu, 20 Nov 2025 01:11:17 +0000
Bug 1983833 - Part 5: Migrate InlineAutocompleteTextField to use M3 Acorn color tokens r=android-reviewers,007,petru
Figma: https://www.figma.com/design/MjufE1X5fvkxZ0YneX4kRd/Android-Library--2025-?node-id=63874-4870&m=dev
Differential Revision: https://phabricator.services.mozilla.com/D270339
Diffstat:
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/mobile/android/android-components/components/compose/browser-toolbar/src/main/java/mozilla/components/compose/browser/toolbar/ui/InlineAutocompleteTextField.kt b/mobile/android/android-components/components/compose/browser-toolbar/src/main/java/mozilla/components/compose/browser/toolbar/ui/InlineAutocompleteTextField.kt
@@ -20,6 +20,7 @@ import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.text.BasicTextField
import androidx.compose.foundation.text.KeyboardActions
import androidx.compose.foundation.text.KeyboardOptions
+import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
@@ -125,7 +126,7 @@ internal fun InlineAutocompleteTextField(
}
var currentSuggestion: AutocompleteResult? by remember(suggestion) { mutableStateOf(suggestion) }
- val suggestionTextColor = AcornTheme.colors.textPrimary
+ val suggestionTextColor = MaterialTheme.colorScheme.onSurface
val highlightBackgroundColor = Color(TEXT_HIGHLIGHT_COLOR.toColorInt())
val suggestionVisualTransformation = remember(currentSuggestion, textFieldValue) {
when (textFieldValue.text.isEmpty()) {
@@ -219,7 +220,7 @@ internal fun InlineAutocompleteTextField(
.focusRequester(focusRequester),
textStyle = TextStyle(
fontSize = TEXT_SIZE.sp,
- color = AcornTheme.colors.textPrimary,
+ color = MaterialTheme.colorScheme.onSurface,
textAlign = when (deviceLayoutDirection) {
LayoutDirection.Ltr -> TextAlign.Start
LayoutDirection.Rtl -> TextAlign.End
@@ -255,7 +256,7 @@ internal fun InlineAutocompleteTextField(
}
}
},
- cursorBrush = SolidColor(AcornTheme.colors.textPrimary),
+ cursorBrush = SolidColor(MaterialTheme.colorScheme.primary),
decorationBox = { innerTextField ->
Box(
modifier = Modifier
@@ -292,7 +293,7 @@ internal fun InlineAutocompleteTextField(
text = hint,
style = TextStyle(
fontSize = TEXT_SIZE.sp,
- color = AcornTheme.colors.textSecondary,
+ color = MaterialTheme.colorScheme.onSurfaceVariant,
),
)
}
@@ -457,7 +458,7 @@ private class PasteSanitizerTextToolbar(
private fun InlineAutocompleteTextFieldWithSuggestion() {
AcornTheme {
Box(
- Modifier.background(AcornTheme.colors.layer1),
+ Modifier.background(MaterialTheme.colorScheme.surfaceDim),
) {
InlineAutocompleteTextField(
query = "wiki",
@@ -481,7 +482,7 @@ private fun InlineAutocompleteTextFieldWithSuggestion() {
private fun InlineAutocompleteTextFieldWithNoQuery() {
AcornTheme {
Box(
- Modifier.background(AcornTheme.colors.layer1),
+ Modifier.background(MaterialTheme.colorScheme.surfaceDim),
) {
InlineAutocompleteTextField(
query = "",