Skip to content

Commit 8927d2d

Browse files
committed
Update AutofillSnippets.kt
clean up
1 parent 635ea2c commit 8927d2d

File tree

1 file changed

+15
-23
lines changed

1 file changed

+15
-23
lines changed

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

Lines changed: 15 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -56,16 +56,13 @@ fun AddMultipleTypesOfAutofill() {
5656
mutableStateOf(TextFieldValue(""))
5757
}
5858
// [START android_compose_autofill_2]
59-
Column {
60-
TextField(
61-
value = textFieldValue.value,
62-
onValueChange = {textFieldValue.value = it},
63-
modifier =
64-
Modifier.semantics {
65-
contentType = ContentType.Username + ContentType.EmailAddress
66-
},
67-
)
68-
}
59+
TextField(
60+
value = textFieldValue.value,
61+
onValueChange = { textFieldValue.value = it },
62+
modifier = Modifier.semantics {
63+
contentType = ContentType.Username + ContentType.EmailAddress
64+
}
65+
)
6966
// [END android_compose_autofill_2]
7067
}
7168

@@ -87,22 +84,16 @@ fun SaveDataWithAutofill() {
8784
Column {
8885
TextField(
8986
value = textFieldValue.value,
90-
onValueChange = {textFieldValue.value = it},
91-
modifier =
92-
Modifier.semantics {
93-
contentType = ContentType.NewUsername
94-
},
87+
onValueChange = { textFieldValue.value = it },
88+
modifier = Modifier.semantics { contentType = ContentType.NewUsername }
9589
)
9690

9791
Spacer(modifier = Modifier.height(16.dp))
9892

9993
TextField(
10094
value = textFieldValue.value,
101-
onValueChange = {textFieldValue.value = it},
102-
modifier =
103-
Modifier.semantics {
104-
contentType = ContentType.NewPassword
105-
},
95+
onValueChange = { textFieldValue.value = it },
96+
modifier = Modifier.semantics { contentType = ContentType.NewPassword }
10697
)
10798
}
10899
// [END android_compose_autofill_4]
@@ -119,7 +110,7 @@ fun SaveDataWithAutofillOnClick() {
119110
Column {
120111
TextField(
121112
value = textFieldValue.value,
122-
onValueChange = {textFieldValue.value = it},
113+
onValueChange = { textFieldValue.value = it },
123114
modifier =
124115
Modifier.semantics {
125116
contentType = ContentType.NewUsername
@@ -130,7 +121,7 @@ fun SaveDataWithAutofillOnClick() {
130121

131122
TextField(
132123
value = textFieldValue.value,
133-
onValueChange = {textFieldValue.value = it},
124+
onValueChange = { textFieldValue.value = it },
134125
modifier =
135126
Modifier.semantics {
136127
contentType = ContentType.NewPassword
@@ -150,10 +141,11 @@ fun CustomAutofillHighlight(customHighlightColor: Color = Color.Red) {
150141
}
151142
// [START android_compose_autofill_6]
152143
val customHighlightColor = Color.Red
144+
153145
CompositionLocalProvider(LocalAutofillHighlightColor provides customHighlightColor) {
154146
TextField(
155147
value = textFieldValue.value,
156-
onValueChange = {textFieldValue.value = it},
148+
onValueChange = { textFieldValue.value = it },
157149
modifier = Modifier.semantics {
158150
contentType = ContentType.Username
159151
}

0 commit comments

Comments
 (0)