Skip to content

Commit 962f3e9

Browse files
riggaroogithub-actions[bot]
authored andcommitted
Apply Spotless
1 parent b574770 commit 962f3e9

File tree

2 files changed

+55
-52
lines changed

2 files changed

+55
-52
lines changed

compose/snippets/src/main/java/com/example/compose/snippets/graphics/GraphicsModifiersSnippets.kt

Lines changed: 46 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,8 @@ fun ModifierGraphicsLayerAlpha() {
321321
fun ModifierGraphicsLayerCompositingStrategy() {
322322
// [START android_compose_graphics_modifiers_graphicsLayer_compositing_strategy]
323323

324-
Image(painter = painterResource(id = R.drawable.dog),
324+
Image(
325+
painter = painterResource(id = R.drawable.dog),
325326
contentDescription = "Dog",
326327
contentScale = ContentScale.Crop,
327328
modifier = Modifier
@@ -373,11 +374,9 @@ fun ModifierGraphicsLayerCompositingStrategy() {
373374
)
374375
)
375376
}
376-
377377
}
378378
)
379379
// [END android_compose_graphics_modifiers_graphicsLayer_compositing_strategy]
380-
381380
}
382381

383382
@Preview
@@ -390,8 +389,8 @@ fun CompositingStrategyExamples() {
390389
.wrapContentSize(Alignment.Center)
391390
) {
392391
// Does not clip content even with a graphics layer usage here. By default, graphicsLayer
393-
//does not allocate + rasterize content into a separate layer but instead is used
394-
//for isolation. That is draw invalidations made outside of this graphicsLayer will not
392+
// does not allocate + rasterize content into a separate layer but instead is used
393+
// for isolation. That is draw invalidations made outside of this graphicsLayer will not
395394
// re-record the drawing instructions in this composable as they have not changed *
396395
Canvas(
397396
modifier = Modifier
@@ -441,22 +440,26 @@ fun CompositingStrategy_ModulateAlpha() {
441440
Spacer(modifier = Modifier.size(36.dp))
442441

443442
// Alpha 0.5f applied to whole composable
444-
Canvas(modifier = Modifier
445-
.size(200.dp)
446-
.graphicsLayer {
447-
alpha = 0.5f
448-
}) {
443+
Canvas(
444+
modifier = Modifier
445+
.size(200.dp)
446+
.graphicsLayer {
447+
alpha = 0.5f
448+
}
449+
) {
449450
drawSquares()
450451
}
451452
Spacer(modifier = Modifier.size(36.dp))
452453

453454
// 0.75f alpha applied to each draw call when using ModulateAlpha
454-
Canvas(modifier = Modifier
455-
.size(200.dp)
456-
.graphicsLayer {
457-
compositingStrategy = CompositingStrategy.ModulateAlpha
458-
alpha = 0.75f
459-
}) {
455+
Canvas(
456+
modifier = Modifier
457+
.size(200.dp)
458+
.graphicsLayer {
459+
compositingStrategy = CompositingStrategy.ModulateAlpha
460+
alpha = 0.75f
461+
}
462+
) {
460463
drawSquares()
461464
}
462465
}
@@ -508,17 +511,19 @@ fun ModifierGraphicsFlippedUsage() {
508511
// [START android_compose_graphics_faded_edge_example]
509512
@Composable
510513
fun FadedEdgeBox(modifier: Modifier = Modifier, content: @Composable () -> Unit) {
511-
Box(modifier = modifier
512-
.graphicsLayer(compositingStrategy = CompositingStrategy.Offscreen)
513-
.drawWithContent {
514-
drawContent()
515-
drawRect(
516-
brush = Brush.verticalGradient(
517-
listOf(Color.Black, Color.Transparent)
518-
),
519-
blendMode = BlendMode.DstIn
520-
)
521-
}) {
514+
Box(
515+
modifier = modifier
516+
.graphicsLayer(compositingStrategy = CompositingStrategy.Offscreen)
517+
.drawWithContent {
518+
drawContent()
519+
drawRect(
520+
brush = Brush.verticalGradient(
521+
listOf(Color.Black, Color.Transparent)
522+
),
523+
blendMode = BlendMode.DstIn
524+
)
525+
}
526+
) {
522527
content()
523528
}
524529
}
@@ -587,18 +592,19 @@ fun Avatar(
587592
val stroke = remember(strokeWidth) {
588593
Stroke(width = strokeWidth)
589594
}
590-
Box(modifier = modifier
591-
.drawWithContent {
592-
drawContent()
593-
drawCircle(
594-
Color.Black,
595-
size.minDimension / 2,
596-
size.center,
597-
style = stroke,
598-
blendMode = BlendMode.Clear
599-
)
600-
}
601-
.clip(CircleShape)
595+
Box(
596+
modifier = modifier
597+
.drawWithContent {
598+
drawContent()
599+
drawCircle(
600+
Color.Black,
601+
size.minDimension / 2,
602+
size.center,
603+
style = stroke,
604+
blendMode = BlendMode.Clear
605+
)
606+
}
607+
.clip(CircleShape)
602608
) {
603609
content()
604610
}
@@ -661,4 +667,4 @@ private fun StackedAvatars() {
661667
}
662668
}
663669
}
664-
// [END android_compose_graphics_stacked_clipped_avatars]
670+
// [END android_compose_graphics_stacked_clipped_avatars]

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

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
package com.example.compose.snippets.text
2020

2121
import android.graphics.Typeface
22-
import android.provider.ContactsContract.CommonDataKinds.Email
2322
import androidx.compose.foundation.BorderStroke
2423
import androidx.compose.foundation.background
2524
import androidx.compose.foundation.basicMarquee
@@ -29,15 +28,13 @@ import androidx.compose.foundation.layout.Arrangement
2928
import androidx.compose.foundation.layout.Box
3029
import androidx.compose.foundation.layout.Column
3130
import androidx.compose.foundation.layout.Row
32-
import androidx.compose.foundation.layout.Spacer
3331
import androidx.compose.foundation.layout.fillMaxWidth
3432
import androidx.compose.foundation.layout.padding
3533
import androidx.compose.foundation.layout.requiredSize
3634
import androidx.compose.foundation.layout.width
3735
import androidx.compose.foundation.shape.RoundedCornerShape
3836
import androidx.compose.foundation.text.BasicSecureTextField
3937
import androidx.compose.foundation.text.KeyboardOptions
40-
import androidx.compose.foundation.text.input.TextFieldDecorator
4138
import androidx.compose.foundation.text.input.TextFieldState
4239
import androidx.compose.foundation.text.input.TextObfuscationMode
4340
import androidx.compose.foundation.text.selection.DisableSelection
@@ -50,7 +47,6 @@ import androidx.compose.material3.LocalTextStyle
5047
import androidx.compose.material3.MaterialTheme
5148
import androidx.compose.material3.OutlinedTextField
5249
import androidx.compose.material3.Text
53-
import androidx.compose.material3.TextButton
5450
import androidx.compose.material3.TextField
5551
import androidx.compose.runtime.Composable
5652
import androidx.compose.runtime.derivedStateOf
@@ -650,9 +646,9 @@ private fun TextSample(samples: Map<String, @Composable () -> Unit>) {
650646

651647
private const val SAMPLE_LONG_TEXT =
652648
"Jetpack Compose is Android’s modern toolkit for building native UI. " +
653-
"It simplifies and accelerates UI development on Android bringing your apps " +
654-
"to life with less code, powerful tools, and intuitive Kotlin APIs. " +
655-
"It makes building Android UI faster and easier."
649+
"It simplifies and accelerates UI development on Android bringing your apps " +
650+
"to life with less code, powerful tools, and intuitive Kotlin APIs. " +
651+
"It makes building Android UI faster and easier."
656652

657653
@Composable
658654
@Preview
@@ -888,9 +884,11 @@ fun PasswordTextField() {
888884
.padding(6.dp),
889885
decorator = { innerTextField ->
890886
Box(modifier = Modifier.fillMaxWidth()) {
891-
Box(modifier = Modifier
892-
.align(Alignment.CenterStart)
893-
.padding(start = 16.dp,end = 48.dp)) {
887+
Box(
888+
modifier = Modifier
889+
.align(Alignment.CenterStart)
890+
.padding(start = 16.dp, end = 48.dp)
891+
) {
894892
innerTextField()
895893
}
896894
Icon(
@@ -911,7 +909,6 @@ fun PasswordTextField() {
911909
}
912910
// [END android_compose_text_showhidepassword]
913911

914-
915912
// [START android_compose_text_auto_format_phone_number_validatetext]
916913
class EmailViewModel : ViewModel() {
917914
var email by mutableStateOf("")
@@ -963,4 +960,4 @@ fun ValidateInput() {
963960
validatorHasErrors = emailViewModel.emailHasErrors
964961
)
965962
}
966-
// [END android_compose_text_auto_format_phone_number_validatetext]
963+
// [END android_compose_text_auto_format_phone_number_validatetext]

0 commit comments

Comments
 (0)