Skip to content

Commit

Permalink
Fix: Add Android Spotless Config
Browse files Browse the repository at this point in the history
  • Loading branch information
8954sood committed Mar 26, 2024
1 parent 9a211bd commit 41155ae
Show file tree
Hide file tree
Showing 10 changed files with 43 additions and 73 deletions.
10 changes: 0 additions & 10 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,6 @@

@Suppress("DSL_SCOPE_VIOLATION") // TODO: Remove once KTIJ-19369 is fixed
plugins {
// alias(libs.plugins.android.application)
// alias(libs.plugins.seugi.android)
// alias(libs.plugins.seugi.android.compose)
// alias(libs.plugins.seugi.android.application)
// alias(libs.plugins.kotlin.android)
// alias(libs.plugins.android.application)
// alias()
// alias(libs.plugins.seugi.android.kotlin)
// alias(libs.plugins.seugi.android.hilt)

alias(libs.plugins.seugi.android.application)
alias(libs.plugins.seugi.android.kotlin)
alias(libs.plugins.seugi.android.compose)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
package com.apeun.gidaechi.seugi

import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4

import androidx.test.platform.app.InstrumentationRegistry
import org.junit.Assert.assertEquals
import org.junit.Test
import org.junit.runner.RunWith

import org.junit.Assert.*

/**
* Instrumented test, which will execute on an Android device.
*
Expand All @@ -21,4 +19,4 @@ class ExampleInstrumentedTest {
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("com.apeun.gidaechi.seugi", appContext.packageName)
}
}
}
6 changes: 3 additions & 3 deletions app/src/main/java/com/apeun/gidaechi/seugi/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class MainActivity : ComponentActivity() {
// A surface container using the 'background' color from the theme
Surface(
modifier = Modifier.fillMaxSize(),
color = MaterialTheme.colorScheme.background
color = MaterialTheme.colorScheme.background,
) {
Greeting("Android")
}
Expand All @@ -33,7 +33,7 @@ class MainActivity : ComponentActivity() {
fun Greeting(name: String, modifier: Modifier = Modifier) {
Text(
text = "Hello $name!",
modifier = modifier
modifier = modifier,
)
}

Expand All @@ -43,4 +43,4 @@ fun GreetingPreview() {
SeugiTestTheme {
Greeting("Android")
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ val Pink80 = Color(0xFFEFB8C8)

val Purple40 = Color(0xFF6650a4)
val PurpleGrey40 = Color(0xFF625b71)
val Pink40 = Color(0xFF7D5260)
val Pink40 = Color(0xFF7D5260)
12 changes: 6 additions & 6 deletions app/src/main/java/com/apeun/gidaechi/seugi/ui/theme/Theme.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ import androidx.core.view.WindowCompat
private val DarkColorScheme = darkColorScheme(
primary = Purple80,
secondary = PurpleGrey80,
tertiary = Pink80
tertiary = Pink80,
)

private val LightColorScheme = lightColorScheme(
primary = Purple40,
secondary = PurpleGrey40,
tertiary = Pink40
tertiary = Pink40,

/* Other default colors to override
background = Color(0xFFFFFBFE),
Expand All @@ -34,15 +34,15 @@ private val LightColorScheme = lightColorScheme(
onTertiary = Color.White,
onBackground = Color(0xFF1C1B1F),
onSurface = Color(0xFF1C1B1F),
*/
*/
)

@Composable
fun SeugiTestTheme(
darkTheme: Boolean = isSystemInDarkTheme(),
// Dynamic color is available on Android 12+
dynamicColor: Boolean = true,
content: @Composable () -> Unit
content: @Composable () -> Unit,
) {
val colorScheme = when {
dynamicColor && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> {
Expand All @@ -65,6 +65,6 @@ fun SeugiTestTheme(
MaterialTheme(
colorScheme = colorScheme,
typography = Typography,
content = content
content = content,
)
}
}
8 changes: 4 additions & 4 deletions app/src/main/java/com/apeun/gidaechi/seugi/ui/theme/Type.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ val Typography = Typography(
fontWeight = FontWeight.Normal,
fontSize = 16.sp,
lineHeight = 24.sp,
letterSpacing = 0.5.sp
)
letterSpacing = 0.5.sp,
),
/* Other default text styles to override
titleLarge = TextStyle(
fontFamily = FontFamily.Default,
Expand All @@ -30,5 +30,5 @@ val Typography = Typography(
lineHeight = 16.sp,
letterSpacing = 0.5.sp
)
*/
)
*/
)
5 changes: 2 additions & 3 deletions app/src/test/java/com/apeun/gidaechi/seugi/ExampleUnitTest.kt
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package com.apeun.gidaechi.seugi

import org.junit.Assert.assertEquals
import org.junit.Test

import org.junit.Assert.*

/**
* Example local unit test, which will execute on the development machine (host).
*
Expand All @@ -14,4 +13,4 @@ class ExampleUnitTest {
fun addition_isCorrect() {
assertEquals(4, 2 + 2)
}
}
}

This file was deleted.

This file was deleted.

24 changes: 24 additions & 0 deletions spotless/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
root = true

[*]
charset = utf-8
indent_size = 4
max_line_length = 160

[*.{kt,kts}]
max_line_length = 160
ktlint_code_style = android_studio
ktlint_standard_function-naming = disabled
ktlint_standard_annotation = disabled
ij_kotlin_allow_trailing_comma_on_call_site=true
ij_kotlin_allow_trailing_comma=true
ktlint_no-wildcard-imports = disabled


[**/test/**.kt]
max_line_length = off
ktlint_ignore_back_ticked_identifier = true

[**/androidTest/**.kt]
max_line_length = off
ktlint_ignore_back_ticked_identifier = true

0 comments on commit 41155ae

Please sign in to comment.