Skip to content

Commit f1d108e

Browse files
MagicalMeghangithub-actions[bot]
authored andcommitted
Apply Spotless
1 parent 45244fc commit f1d108e

File tree

1 file changed

+26
-22
lines changed

1 file changed

+26
-22
lines changed

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

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*
2+
* Copyright 2025 The Android Open Source Project
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
117
package com.example.compose.snippets.text
218

319
import android.text.TextUtils
@@ -19,7 +35,6 @@ import androidx.compose.foundation.text.input.setTextAndPlaceCursorAtEnd
1935
import androidx.compose.foundation.text.input.then
2036
import androidx.compose.material.SecureTextField
2137
import androidx.compose.material.TextField
22-
2338
import androidx.compose.material3.Button
2439
import androidx.compose.material3.CircularProgressIndicator
2540
import androidx.compose.material3.Text
@@ -95,15 +110,15 @@ fun StyleWithBrush() {
95110

96111
// [START android_compose_state_text_6]
97112
// TODO fix this snippet
98-
//val usernameState = rememberTextFieldState()
99-
//TextField(
100-
//state = usernameState,
101-
//lineLimits = TextFieldLineLimits.SingleLine,
102-
//placeholder = { Text("Enter Username") }
103-
//)
104-
val LoginRepository = "repository"
105-
106-
class LoginViewModel(val loginRepository: Repository): ViewModel() {
113+
// val usernameState = rememberTextFieldState()
114+
// TextField(
115+
// state = usernameState,
116+
// lineLimits = TextFieldLineLimits.SingleLine,
117+
// placeholder = { Text("Enter Username") }
118+
// )
119+
val LoginRepository = "repository"
120+
121+
class LoginViewModel(val loginRepository: Repository) : ViewModel() {
107122
val username = TextFieldState()
108123
val password = TextFieldState()
109124

@@ -150,13 +165,11 @@ fun LoginForm(
150165

151166
class Repository {
152167
fun login(username: String, password: String) {
153-
154168
}
155169
}
156170

157171
@Composable
158172
fun TextFieldPlaceholder() {
159-
160173
}
161174

162175
@Preview
@@ -214,7 +227,6 @@ fun EditTextFieldState() {
214227

215228
class TextFieldViewModel : ViewModel() {
216229
fun validateUsername() {
217-
218230
}
219231
}
220232
val textFieldViewModel = TextFieldViewModel()
@@ -232,8 +244,6 @@ fun TextFieldKeyboardOptions() {
232244
// [END android_compose_state_text_13]
233245
}
234246

235-
236-
237247
@Composable
238248
fun TextFieldInputTransformation() {
239249
// [START android_compose_state_text_14]
@@ -251,14 +261,11 @@ fun TextFieldInputTransformation() {
251261
.then(CustomInputTransformation()),
252262
)
253263
// [END android_compose_state_text_17]
254-
255264
}
256265

257266
// [START android_compose_state_text_15]
258267
class CustomInputTransformation : InputTransformation {
259268
override fun TextFieldBuffer.transformInput() {
260-
261-
262269
}
263270
}
264271
// [END android_compose_state_text_15]
@@ -276,8 +283,6 @@ class DigitOnlyInputTransformation : InputTransformation {
276283
// [START android_compose_state_text_17]
277284
class CustomOutputTransformation : OutputTransformation {
278285
override fun TextFieldBuffer.transformOutput() {
279-
280-
281286
}
282287
}
283288
// [END android_compose_state_text_17]
@@ -292,7 +297,6 @@ class PhoneNumberOutputTransformation : OutputTransformation {
292297
}
293298
// [END android_compose_state_text_18]
294299

295-
296300
@Composable
297301
fun TextFieldOutputTransformation() {
298302
// [START android_compose_state_text_19]
@@ -301,4 +305,4 @@ fun TextFieldOutputTransformation() {
301305
outputTransformation = PhoneNumberOutputTransformation()
302306
)
303307
// [END android_compose_state_text_19]
304-
}
308+
}

0 commit comments

Comments
 (0)