Skip to content

Commit c3c53cf

Browse files
committed
style: apply spotless
1 parent 4235aa7 commit c3c53cf

File tree

7 files changed

+28
-36
lines changed

7 files changed

+28
-36
lines changed

demo/src/main/java/io/monstarlab/mosaic/MainActivity.kt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@ import android.os.Bundle
44
import androidx.activity.ComponentActivity
55
import androidx.activity.compose.setContent
66
import androidx.activity.enableEdgeToEdge
7-
import androidx.compose.foundation.layout.fillMaxSize
8-
import androidx.compose.foundation.layout.padding
9-
import androidx.compose.material3.Scaffold
10-
import androidx.compose.material3.Slider
117
import androidx.compose.material3.Text
128
import androidx.compose.runtime.Composable
139
import androidx.compose.ui.Modifier

demo/src/main/java/io/monstarlab/mosaic/features/SliderDemo.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ fun SliderDemo() = Scaffold(modifier = Modifier) {
2020
value = 0.5f,
2121
onValueChange = {},
2222
colors = SliderColors(Color.Red),
23-
modifier = Modifier.clip(RoundedCornerShape(2.dp))
23+
modifier = Modifier.clip(RoundedCornerShape(2.dp)),
2424
)
2525
}
2626
}
@@ -29,4 +29,4 @@ fun SliderDemo() = Scaffold(modifier = Modifier) {
2929
@Composable
3030
private fun PreviewSliderDemo() {
3131
SliderDemo()
32-
}
32+
}

slider/src/androidTest/java/io/monstarlab/mosaic/slider/ExampleInstrumentedTest.kt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
package io.monstarlab.mosaic.slider
22

3-
import androidx.test.platform.app.InstrumentationRegistry
43
import androidx.test.ext.junit.runners.AndroidJUnit4
5-
4+
import androidx.test.platform.app.InstrumentationRegistry
5+
import org.junit.Assert.assertEquals
66
import org.junit.Test
77
import org.junit.runner.RunWith
88

9-
import org.junit.Assert.*
10-
119
/**
1210
* Instrumented test, which will execute on an Android device.
1311
*
@@ -21,4 +19,4 @@ class ExampleInstrumentedTest {
2119
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
2220
assertEquals("io.monstarlab.mosaic.slider.test", appContext.packageName)
2321
}
24-
}
22+
}

slider/src/main/java/io/monstarlab/mosaic/slider/SliderDefaults.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ internal object SliderDefaults {
77
val ThumbSize = 16.dp
88
val HandleHeight = 16.0.dp
99
val HandleWidth = 20.0.dp
10-
}
10+
}

slider/src/main/java/io/monstarlab/mosaic/slider/SliderLayout.kt

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public fun SliderLayout(
2323
progress: Float,
2424
modifier: Modifier = Modifier,
2525
track: @Composable () -> Unit,
26-
thumb: @Composable () -> Unit
26+
thumb: @Composable () -> Unit,
2727
) {
2828
Layout(
2929
modifier = modifier.requiredSizeIn(SliderDefaults.HandleWidth, SliderDefaults.HandleHeight),
@@ -34,18 +34,20 @@ public fun SliderLayout(
3434
Box(modifier = Modifier.layoutId(SliderLayoutElements.Thumb)) {
3535
thumb()
3636
}
37-
}) { mesuarables, constraints ->
37+
},
38+
) { mesuarables, constraints ->
3839

3940
val thumbPlaceable = mesuarables
4041
.first { it.layoutId == SliderLayoutElements.Thumb }
4142
.measure(constraints)
4243

4344
val trackPlaceable = mesuarables
4445
.first { it.layoutId == SliderLayoutElements.Track }
45-
.measure(constraints.offset(
46-
horizontal = - thumbPlaceable.width
47-
).copy(minHeight = 0))
48-
46+
.measure(
47+
constraints.offset(
48+
horizontal = -thumbPlaceable.width,
49+
).copy(minHeight = 0),
50+
)
4951

5052
val sliderHeight = max(thumbPlaceable.height, trackPlaceable.height)
5153
val sliderWidth = trackPlaceable.width
@@ -58,12 +60,11 @@ public fun SliderLayout(
5860
}
5961
}
6062

61-
6263
internal enum class SliderLayoutElements {
63-
Track, Thumb
64+
Track,
65+
Thumb,
6466
}
6567

66-
6768
@Preview
6869
@Composable
6970
private fun PreviewSliderLayout() {
@@ -75,14 +76,15 @@ private fun PreviewSliderLayout() {
7576
modifier = Modifier
7677
.background(Color.Yellow)
7778
.height(15.dp)
78-
.fillMaxWidth()
79+
.fillMaxWidth(),
7980
)
8081
},
8182
thumb = {
8283
Box(
8384
modifier = Modifier
8485
.size(32.dp)
85-
.background(Color.Black, shape = CircleShape)
86+
.background(Color.Black, shape = CircleShape),
8687
)
87-
})
88-
}
88+
},
89+
)
90+
}

slider/src/main/java/io/monstarlab/mosaic/slider/SliderTrack.kt

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package io.monstarlab.mosaic.slider
22

3-
import androidx.compose.foundation.Canvas
43
import androidx.compose.foundation.layout.Box
54
import androidx.compose.foundation.layout.fillMaxWidth
65
import androidx.compose.foundation.layout.heightIn
@@ -19,7 +18,6 @@ internal fun SliderTrack(
1918
modifier: Modifier = Modifier,
2019
disabledRange: ClosedFloatingPointRange<Float> = 0f..0f,
2120
) {
22-
2321
check(progress in 0f..1f) { "Invalid progress value should be between 0 and 1" }
2422
Box(
2523
modifier = modifier
@@ -30,13 +28,13 @@ internal fun SliderTrack(
3028
drawRect(
3129
color = colors.active,
3230
topLeft = Offset.Zero,
33-
size = Size(activeRectWidth, size.height)
31+
size = Size(activeRectWidth, size.height),
3432
)
3533

3634
drawRect(
3735
color = colors.inactive,
3836
topLeft = Offset(activeRectWidth, 0f),
39-
size = Size(size.width - activeRectWidth, size.height)
37+
size = Size(size.width - activeRectWidth, size.height),
4038
)
4139

4240
if (!disabledRange.isEmpty()) {
@@ -45,14 +43,13 @@ internal fun SliderTrack(
4543
drawRect(
4644
color = colors.disabled,
4745
topLeft = Offset(size.width * disabledRange.start, 0f),
48-
size = Size(disabledEnd - disabledStart, size.height)
46+
size = Size(disabledEnd - disabledStart, size.height),
4947
)
5048
}
51-
}
49+
},
5250
)
5351
}
5452

55-
5653
@Preview
5754
@Composable
5855
private fun PreviewSliderTrack() {
@@ -61,4 +58,4 @@ private fun PreviewSliderTrack() {
6158
colors = SliderColors(Color.Yellow),
6259
disabledRange = 0.8f..1f,
6360
)
64-
}
61+
}
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
package io.monstarlab.mosaic.slider
22

3+
import org.junit.Assert.assertEquals
34
import org.junit.Test
45

5-
import org.junit.Assert.*
6-
76
/**
87
* Example local unit test, which will execute on the development machine (host).
98
*
@@ -14,4 +13,4 @@ class ExampleUnitTest {
1413
fun addition_isCorrect() {
1514
assertEquals(4, 2 + 2)
1615
}
17-
}
16+
}

0 commit comments

Comments
 (0)