Skip to content

Commit 6ef0974

Browse files
authored
Fix spotless configuration and apply to all samples except Jetcaster (#1563)
Jetcaster is refactored in #1561, so the same config will be applied there, but I won't format it here, because it would create a million conflicts.
2 parents 9c032e2 + 0ae802d commit 6ef0974

File tree

154 files changed

+2113
-2707
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

154 files changed

+2113
-2707
lines changed

JetLagged/.editorconfig

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# When authoring changes in .editorconfig, run ./gradlew spotlessApply --no-daemon
2+
# Reference: https://github.com/diffplug/spotless/issues/1924
3+
[*.{kt,kts}]
4+
ktlint_code_style = android_studio
5+
ij_kotlin_allow_trailing_comma = true
6+
ij_kotlin_allow_trailing_comma_on_call_site = true
7+
max_line_length = 140 # ktlint official
8+
ktlint_function_naming_ignore_when_annotated_with = Composable, Test
9+
ktlint_standard_filename = disabled
10+
ktlint_standard_package-name = disabled
11+
ktlint_standard_property-naming = disabled
12+
ktlint_standard_backing-property-naming = disabled
13+
ktlint_standard_argument-list-wrapping=disabled
14+
ktlint_standard_parameter-list-wrapping = disabled
15+
ktlint_standard_double-colon-spacing=disabled
16+
ktlint_standard_enum-entry-name-case=disabled
17+
ktlint_standard_multiline-if-else=disabled
18+
ktlint_standard_no-empty-first-line-in-method-block = disabled
19+
ktlint_standard_package-name = disabled
20+
ktlint_standard_trailing-comma = disabled
21+
ktlint_standard_spacing-around-angle-brackets = disabled
22+
ktlint_standard_spacing-between-declarations-with-annotations = disabled
23+
ktlint_standard_spacing-between-declarations-with-comments = disabled
24+
ktlint_standard_unary-op-spacing = disabled
25+
ktlint_standard_function-expression-body = disabled
26+
ktlint_standard_value-parameter-comment = disabled
27+
ktlint_argument_list_wrapping_ignore_when_parameter_count_greater_or_equal_than= unset

JetLagged/app/build.gradle.kts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* you may not use this file except in compliance with the License.
66
* You may obtain a copy of the License at
77
*
8-
* http://www.apache.org/licenses/LICENSE-2.0
8+
* https://www.apache.org/licenses/LICENSE-2.0
99
*
1010
* Unless required by applicable law or agreed to in writing, software
1111
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -14,6 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17+
1718
plugins {
1819
alias(libs.plugins.android.application)
1920
alias(libs.plugins.kotlin.android)
@@ -49,22 +50,25 @@ android {
4950

5051
buildTypes {
5152
getByName("debug") {
52-
5353
}
5454

5555
getByName("release") {
5656
isMinifyEnabled = true
5757
signingConfig = signingConfigs.getByName("release")
58-
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"),
59-
"proguard-rules.pro")
58+
proguardFiles(
59+
getDefaultProguardFile("proguard-android-optimize.txt"),
60+
"proguard-rules.pro",
61+
)
6062
}
6163

6264
create("benchmark") {
6365
initWith(getByName("release"))
6466
signingConfig = signingConfigs.getByName("release")
6567
matchingFallbacks.add("release")
66-
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"),
67-
"proguard-benchmark-rules.pro")
68+
proguardFiles(
69+
getDefaultProguardFile("proguard-android-optimize.txt"),
70+
"proguard-benchmark-rules.pro",
71+
)
6872
isDebuggable = false
6973
}
7074
}

JetLagged/app/src/main/java/com/example/jetlagged/HomeScreenCards.kt

Lines changed: 26 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -68,20 +68,16 @@ import com.example.jetlagged.ui.theme.JetLaggedTheme
6868
import com.example.jetlagged.ui.theme.SmallHeadingStyle
6969

7070
@Composable
71-
fun BasicInformationalCard(
72-
modifier: Modifier = Modifier,
73-
borderColor: Color,
74-
content: @Composable () -> Unit
75-
) {
71+
fun BasicInformationalCard(modifier: Modifier = Modifier, borderColor: Color, content: @Composable () -> Unit) {
7672
val shape = RoundedCornerShape(24.dp)
7773
Card(
7874
shape = shape,
7975
colors = CardDefaults.cardColors(
80-
containerColor = JetLaggedTheme.extraColors.cardBackground
76+
containerColor = JetLaggedTheme.extraColors.cardBackground,
8177
),
8278
modifier = modifier
8379
.padding(8.dp),
84-
border = BorderStroke(2.dp, borderColor)
80+
border = BorderStroke(2.dp, borderColor),
8581
) {
8682
Box {
8783
content()
@@ -90,20 +86,14 @@ fun BasicInformationalCard(
9086
}
9187

9288
@Composable
93-
fun TwoLineInfoCard(
94-
borderColor: Color,
95-
firstLineText: String,
96-
secondLineText: String,
97-
icon: ImageVector,
98-
modifier: Modifier = Modifier
99-
) {
89+
fun TwoLineInfoCard(borderColor: Color, firstLineText: String, secondLineText: String, icon: ImageVector, modifier: Modifier = Modifier) {
10090
BasicInformationalCard(
10191
borderColor = borderColor,
102-
modifier = modifier.size(200.dp)
92+
modifier = modifier.size(200.dp),
10393
) {
10494
BubbleBackground(
10595
modifier = Modifier.fillMaxSize(),
106-
numberBubbles = 3, bubbleColor = borderColor.copy(0.25f)
96+
numberBubbles = 3, bubbleColor = borderColor.copy(0.25f),
10797
)
10898
BoxWithConstraints(
10999
modifier = Modifier
@@ -114,23 +104,23 @@ fun TwoLineInfoCard(
114104
Row(
115105
modifier = Modifier
116106
.wrapContentSize()
117-
.align(CenterStart)
107+
.align(CenterStart),
118108
) {
119109
Icon(
120110
icon, contentDescription = null,
121111
modifier = Modifier
122112
.size(50.dp)
123-
.align(CenterVertically)
113+
.align(CenterVertically),
124114
)
125115
Spacer(modifier = Modifier.width(16.dp))
126116
Column(
127117
modifier = Modifier
128118
.align(CenterVertically)
129-
.wrapContentSize()
119+
.wrapContentSize(),
130120
) {
131121
Text(
132122
firstLineText,
133-
style = SmallHeadingStyle
123+
style = SmallHeadingStyle,
134124
)
135125
Text(
136126
secondLineText,
@@ -142,25 +132,25 @@ fun TwoLineInfoCard(
142132
Column(
143133
modifier = Modifier
144134
.wrapContentSize()
145-
.align(Center)
135+
.align(Center),
146136
) {
147137
Icon(
148138
icon, contentDescription = null,
149139
modifier = Modifier
150140
.size(50.dp)
151-
.align(CenterHorizontally)
141+
.align(CenterHorizontally),
152142
)
153143
Spacer(modifier = Modifier.height(16.dp))
154144
Column(modifier = Modifier.align(CenterHorizontally)) {
155145
Text(
156146
firstLineText,
157147
style = SmallHeadingStyle,
158-
modifier = Modifier.align(CenterHorizontally)
148+
modifier = Modifier.align(CenterHorizontally),
159149
)
160150
Text(
161151
secondLineText,
162152
style = HeadingStyle,
163-
modifier = Modifier.align(CenterHorizontally)
153+
modifier = Modifier.align(CenterHorizontally),
164154
)
165155
}
166156
}
@@ -180,7 +170,7 @@ fun AverageTimeInBedCard(modifier: Modifier = Modifier) {
180170
icon = Icons.Default.Watch,
181171
modifier = modifier
182172
.wrapContentWidth()
183-
.heightIn(min = 156.dp)
173+
.heightIn(min = 156.dp),
184174
)
185175
}
186176

@@ -195,49 +185,46 @@ fun AverageTimeAsleepCard(modifier: Modifier = Modifier) {
195185
icon = Icons.Default.SingleBed,
196186
modifier = modifier
197187
.wrapContentWidth()
198-
.heightIn(min = 156.dp)
188+
.heightIn(min = 156.dp),
199189
)
200190
}
201191

202192
@OptIn(ExperimentalLayoutApi::class)
203193
@Preview
204194
@Composable
205-
fun WellnessCard(
206-
modifier: Modifier = Modifier,
207-
wellnessData: WellnessData = WellnessData(0, 0, 0)
208-
) {
195+
fun WellnessCard(modifier: Modifier = Modifier, wellnessData: WellnessData = WellnessData(0, 0, 0)) {
209196
BasicInformationalCard(
210197
borderColor = JetLaggedTheme.extraColors.wellness,
211198
modifier = modifier
212199
.widthIn(max = 400.dp)
213-
.heightIn(min = 200.dp)
200+
.heightIn(min = 200.dp),
214201
) {
215202
FadingCircleBackground(36.dp, JetLaggedTheme.extraColors.wellness.copy(0.25f))
216203
Column(
217204
horizontalAlignment = CenterHorizontally,
218205
modifier = Modifier
219-
.fillMaxWidth()
206+
.fillMaxWidth(),
220207
) {
221208
HomeScreenCardHeading(text = stringResource(R.string.wellness_heading))
222209
FlowRow(
223210
horizontalArrangement = Arrangement.Center,
224211
verticalArrangement = Arrangement.Center,
225-
modifier = Modifier.fillMaxHeight()
212+
modifier = Modifier.fillMaxHeight(),
226213
) {
227214
WellnessBubble(
228215
titleText = stringResource(R.string.snoring_heading),
229216
countText = wellnessData.snoring.toString(),
230-
metric = "min"
217+
metric = "min",
231218
)
232219
WellnessBubble(
233220
titleText = stringResource(R.string.coughing_heading),
234221
countText = wellnessData.coughing.toString(),
235-
metric = "times"
222+
metric = "times",
236223
)
237224
WellnessBubble(
238225
titleText = stringResource(R.string.respiration_heading),
239226
countText = wellnessData.respiration.toString(),
240-
metric = "rpm"
227+
metric = "rpm",
241228
)
242229
}
243230
}
@@ -250,7 +237,7 @@ fun WellnessBubble(
250237
countText: String,
251238
metric: String,
252239
modifier: Modifier = Modifier,
253-
bubbleColor: Color = JetLaggedTheme.extraColors.wellness
240+
bubbleColor: Color = JetLaggedTheme.extraColors.wellness,
254241
) {
255242
Column(
256243
modifier = modifier
@@ -261,7 +248,7 @@ fun WellnessBubble(
261248
drawCircle(bubbleColor)
262249
},
263250
verticalArrangement = Arrangement.Center,
264-
horizontalAlignment = CenterHorizontally
251+
horizontalAlignment = CenterHorizontally,
265252
) {
266253
Text(titleText, fontSize = 12.sp)
267254
Text(countText, fontSize = 36.sp)
@@ -277,6 +264,6 @@ fun HomeScreenCardHeading(text: String) {
277264
.fillMaxWidth()
278265
.padding(top = 8.dp),
279266
textAlign = TextAlign.Center,
280-
style = HeadingStyle
267+
style = HeadingStyle,
281268
)
282269
}

0 commit comments

Comments
 (0)