Skip to content

Commit

Permalink
Merge pull request #21 from uswLectureEvaluation/feature/ktlint-detek…
Browse files Browse the repository at this point in the history
…t-ci

Feature/ktlint detekt ci
  • Loading branch information
jinukeu authored Oct 22, 2023
2 parents 6c4464d + ce636fe commit ecf0def
Show file tree
Hide file tree
Showing 401 changed files with 4,594 additions and 4,527 deletions.
19 changes: 19 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
root = true

[*]
charset = utf-8
indent_size = 2
indent_style = space
max_line_length = 150
insert_final_newline = true
trim_trailing_whitespace = true
ktlint_standard_filename = disabled
ktlint_standard_import-ordering = disabled
ktlint_standard_annotation = disabled
ktlint_standard_wrapping = disabled
ktlint_standard_argument-list-wrapping = disabled
ktlint_standard_multiline-if-else = disabled

[*.{kt,kts}]
ij_kotlin_allow_trailing_comma = true
ij_kotlin_allow_trailing_comma_on_call_site = true
95 changes: 43 additions & 52 deletions app-compose/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,61 +1,52 @@
plugins {
id("suwiki.android.application")
id("suwiki.android.application.compose")
id("suwiki.android.application")
id("suwiki.android.application.compose")
}

android {
namespace = "com.kunize.uswtimetable"
namespace = "com.kunize.uswtimetable"

defaultConfig {
applicationId = "com.kunize.uswtimetable"
versionCode = 1
versionName = "1.0"
}

buildTypes {
release {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro",
)
}
}
defaultConfig {
applicationId = "com.kunize.uswtimetable"
versionCode = 1
versionName = "1.0"
}
}

dependencies {
implementation(projects.core.database)
implementation(projects.core.model)
implementation(projects.core.network)
implementation(projects.core.security)

implementation(projects.data)
implementation(projects.data.openmajor)
implementation(projects.data.timetable.viewer)
implementation(projects.data.timetable.editor)
implementation(projects.data.lectureevaluation.editor)
implementation(projects.data.lectureevaluation.viewer)
implementation(projects.data.lectureevaluation.report)
implementation(projects.data.lectureevaluation.my)
implementation(projects.data.user)
implementation(projects.data.notice)
implementation(projects.data.signup)

implementation(projects.domain)
implementation(projects.di)

implementation(projects.local.openmajor)
implementation(projects.local.timetable.editor)
implementation(projects.local.timetable.viewer)
implementation(projects.local.user)

implementation(projects.remote.lectureevaluation.editor)
implementation(projects.remote.lectureevaluation.my)
implementation(projects.remote.lectureevaluation.report)
implementation(projects.remote.lectureevaluation.viewer)
implementation(projects.remote.notice)
implementation(projects.remote.openmajor)
implementation(projects.remote.signup)
implementation(projects.remote.timetable.viewer)
implementation(projects.remote.user)
implementation(projects.core.database)
implementation(projects.core.model)
implementation(projects.core.network)
implementation(projects.core.security)

implementation(projects.data)
implementation(projects.data.openmajor)
implementation(projects.data.timetable.viewer)
implementation(projects.data.timetable.editor)
implementation(projects.data.lectureevaluation.editor)
implementation(projects.data.lectureevaluation.viewer)
implementation(projects.data.lectureevaluation.report)
implementation(projects.data.lectureevaluation.my)
implementation(projects.data.user)
implementation(projects.data.notice)
implementation(projects.data.signup)

implementation(projects.domain)
implementation(projects.di)

implementation(projects.local.openmajor)
implementation(projects.local.timetable.editor)
implementation(projects.local.timetable.viewer)
implementation(projects.local.user)

implementation(projects.remote.lectureevaluation.editor)
implementation(projects.remote.lectureevaluation.my)
implementation(projects.remote.lectureevaluation.report)
implementation(projects.remote.lectureevaluation.viewer)
implementation(projects.remote.notice)
implementation(projects.remote.openmajor)
implementation(projects.remote.signup)
implementation(projects.remote.timetable.viewer)
implementation(projects.remote.user)
implementation(libs.junit)
}
Original file line number Diff line number Diff line change
@@ -1,24 +1,22 @@
package com.kunize.uswtimetable

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

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

import org.junit.Assert.*

/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("com.kunize.uswtimetable", appContext.packageName)
}
}
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("com.kunize.uswtimetable", appContext.packageName)
}
}
40 changes: 20 additions & 20 deletions app-compose/src/main/java/com/kunize/uswtimetable/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,34 +13,34 @@ import androidx.compose.ui.tooling.preview.Preview
import com.kunize.uswtimetable.ui.theme.UswtimetableTheme

class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
UswtimetableTheme {
// A surface container using the 'background' color from the theme
Surface(
modifier = Modifier.fillMaxSize(),
color = MaterialTheme.colorScheme.background
) {
Greeting("Android")
}
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
UswtimetableTheme {
// A surface container using the 'background' color from the theme
Surface(
modifier = Modifier.fillMaxSize(),
color = MaterialTheme.colorScheme.background,
) {
Greeting("Android")
}
}
}
}
}

@Composable
fun Greeting(name: String, modifier: Modifier = Modifier) {
Text(
text = "Hello $name!",
modifier = modifier
)
Text(
text = "Hello $name!",
modifier = modifier,
)
}

@Preview(showBackground = true)
@Composable
fun GreetingPreview() {
UswtimetableTheme {
Greeting("Android")
}
}
UswtimetableTheme {
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)
82 changes: 41 additions & 41 deletions app-compose/src/main/java/com/kunize/uswtimetable/ui/theme/Theme.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,55 +16,55 @@ import androidx.compose.ui.platform.LocalView
import androidx.core.view.WindowCompat

private val DarkColorScheme = darkColorScheme(
primary = Purple80,
secondary = PurpleGrey80,
tertiary = Pink80
primary = Purple80,
secondary = PurpleGrey80,
tertiary = Pink80,
)

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

/* Other default colors to override
background = Color(0xFFFFFBFE),
surface = Color(0xFFFFFBFE),
onPrimary = Color.White,
onSecondary = Color.White,
onTertiary = Color.White,
onBackground = Color(0xFF1C1B1F),
onSurface = Color(0xFF1C1B1F),
*/
/**
* Other default colors to override
* background = Color(0xFFFFFBFE),
* surface = Color(0xFFFFFBFE),
* onPrimary = Color.White,
* onSecondary = Color.White,
* onTertiary = Color.White,
* onBackground = Color(0xFF1C1B1F),
* onSurface = Color(0xFF1C1B1F),
*/
primary = Purple40,
secondary = PurpleGrey40,
tertiary = Pink40,
)

@Composable
fun UswtimetableTheme(
darkTheme: Boolean = isSystemInDarkTheme(),
// Dynamic color is available on Android 12+
dynamicColor: Boolean = true,
content: @Composable () -> Unit
darkTheme: Boolean = isSystemInDarkTheme(),
// Dynamic color is available on Android 12+
dynamicColor: Boolean = true,
content: @Composable () -> Unit,
) {
val colorScheme = when {
dynamicColor && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> {
val context = LocalContext.current
if (darkTheme) dynamicDarkColorScheme(context) else dynamicLightColorScheme(context)
}

darkTheme -> DarkColorScheme
else -> LightColorScheme
val colorScheme = when {
dynamicColor && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> {
val context = LocalContext.current
if (darkTheme) dynamicDarkColorScheme(context) else dynamicLightColorScheme(context)
}
val view = LocalView.current
if (!view.isInEditMode) {
SideEffect {
val window = (view.context as Activity).window
window.statusBarColor = colorScheme.primary.toArgb()
WindowCompat.getInsetsController(window, view).isAppearanceLightStatusBars = darkTheme
}

darkTheme -> DarkColorScheme
else -> LightColorScheme
}
val view = LocalView.current
if (!view.isInEditMode) {
SideEffect {
val window = (view.context as Activity).window
window.statusBarColor = colorScheme.primary.toArgb()
WindowCompat.getInsetsController(window, view).isAppearanceLightStatusBars = darkTheme
}
}

MaterialTheme(
colorScheme = colorScheme,
typography = Typography,
content = content
)
}
MaterialTheme(
colorScheme = colorScheme,
typography = Typography,
content = content,
)
}
49 changes: 25 additions & 24 deletions app-compose/src/main/java/com/kunize/uswtimetable/ui/theme/Type.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,28 @@ import androidx.compose.ui.unit.sp

// Set of Material typography styles to start with
val Typography = Typography(
bodyLarge = TextStyle(
fontFamily = FontFamily.Default,
fontWeight = FontWeight.Normal,
fontSize = 16.sp,
lineHeight = 24.sp,
letterSpacing = 0.5.sp
)
/* Other default text styles to override
titleLarge = TextStyle(
fontFamily = FontFamily.Default,
fontWeight = FontWeight.Normal,
fontSize = 22.sp,
lineHeight = 28.sp,
letterSpacing = 0.sp
),
labelSmall = TextStyle(
fontFamily = FontFamily.Default,
fontWeight = FontWeight.Medium,
fontSize = 11.sp,
lineHeight = 16.sp,
letterSpacing = 0.5.sp
)
*/
)
/**
*Other default text styles to override
* titleLarge = TextStyle(
* fontFamily = FontFamily.Default,
* fontWeight = FontWeight.Normal,
* fontSize = 22.sp,
* lineHeight = 28.sp,
* letterSpacing = 0.sp
* ),
* labelSmall = TextStyle(
* fontFamily = FontFamily.Default,
* fontWeight = FontWeight.Medium,
* fontSize = 11.sp,
* lineHeight = 16.sp,
* letterSpacing = 0.5.sp
* )
*/
bodyLarge = TextStyle(
fontFamily = FontFamily.Default,
fontWeight = FontWeight.Normal,
fontSize = 16.sp,
lineHeight = 24.sp,
letterSpacing = 0.5.sp,
),
)
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
package com.kunize.uswtimetable

import junit.framework.TestCase.assertEquals
import org.junit.Test

import org.junit.Assert.*

/**
* Example local unit test, which will execute on the development machine (host).
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
class ExampleUnitTest {
@Test
fun addition_isCorrect() {
assertEquals(4, 2 + 2)
}
}
@Test
fun addition_isCorrect() {
assertEquals(4, 2 + 2)
}
}
Loading

0 comments on commit ecf0def

Please sign in to comment.