Skip to content

Commit 315d4f1

Browse files
committed
Update AutofillSnippets.kt
1 parent 3b9233a commit 315d4f1

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

compose/snippets/src/main/java/com/example/compose/snippets/text/AutofillSnippets.kt

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ import com.example.compose.snippets.touchinput.Button
3939
fun AddAutofill() {
4040
// [START android_compose_autofill_1]
4141
BasicTextField(
42-
state = remember { TextFieldState("Enter your username.") },
42+
state = remember { TextFieldState() },
4343
modifier = Modifier.semantics { contentType = ContentType.Username }
4444
)
4545
// [END android_compose_autofill_1]
@@ -61,11 +61,16 @@ fun AddMultipleTypesOfAutofill() {
6161
}
6262

6363
@Composable
64-
fun SaveDataWithAutofill() {
64+
fun AutofillManager() {
6565
// [START android_compose_autofill_3]
66-
// [START android_compose_autofill_4]
6766
val autofillManager = LocalAutofillManager.current
6867
// [END android_compose_autofill_3]
68+
}
69+
70+
@Composable
71+
fun SaveDataWithAutofill() {
72+
// [START android_compose_autofill_4]
73+
val autofillManager = LocalAutofillManager.current
6974

7075
Column {
7176
BasicTextField(
@@ -122,12 +127,11 @@ fun SaveDataWithAutofillOnClick() {
122127
@Composable
123128
fun customizeAutofillHighlight() {
124129
val customHighlightColor = Color.Red
125-
val usernameState = remember { TextFieldState() }
126130

127131
CompositionLocalProvider(LocalAutofillHighlightColor provides customHighlightColor) {
128132
Column {
129133
BasicTextField(
130-
state = usernameState,
134+
state = remember { TextFieldState() },
131135
modifier = Modifier.semantics {
132136
contentType = ContentType.Username
133137
}

0 commit comments

Comments
 (0)