diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 9ac5b4d..d21578a 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,3 +1,6 @@ +## Related issue 🛠 +- closed #이슈넘버 + ## Work Description ✏️ - 작업 내용 diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 7c05323..826eddf 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -48,6 +48,10 @@ android { buildFeatures { viewBinding = true buildConfig = true + compose = true + } + composeOptions { + kotlinCompilerExtensionVersion = "1.5.13" } } @@ -55,6 +59,12 @@ dependencies { implementation(libs.bundles.androidx) + implementation(libs.bundles.compose) + + // Compose + debugImplementation(libs.compose.ui.tooling) + debugImplementation(libs.compose.ui.test.manifest) + // Test testImplementation(libs.junit) androidTestImplementation(libs.androidx.junit) diff --git a/app/src/main/java/org/sopt/kream/theme/Color.kt b/app/src/main/java/org/sopt/kream/theme/Color.kt new file mode 100644 index 0000000..0c82203 --- /dev/null +++ b/app/src/main/java/org/sopt/kream/theme/Color.kt @@ -0,0 +1,11 @@ +package org.sopt.kream.theme + +import androidx.compose.ui.graphics.Color + +val Purple80 = Color(0xFFD0BCFF) +val PurpleGrey80 = Color(0xFFCCC2DC) +val Pink80 = Color(0xFFEFB8C8) + +val Purple40 = Color(0xFF6650a4) +val PurpleGrey40 = Color(0xFF625b71) +val Pink40 = Color(0xFF7D5260) diff --git a/app/src/main/java/org/sopt/kream/theme/Theme.kt b/app/src/main/java/org/sopt/kream/theme/Theme.kt new file mode 100644 index 0000000..64b687c --- /dev/null +++ b/app/src/main/java/org/sopt/kream/theme/Theme.kt @@ -0,0 +1,72 @@ +package org.sopt.kream.theme + +import android.app.Activity +import android.os.Build +import androidx.compose.foundation.isSystemInDarkTheme +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.darkColorScheme +import androidx.compose.material3.dynamicDarkColorScheme +import androidx.compose.material3.dynamicLightColorScheme +import androidx.compose.material3.lightColorScheme +import androidx.compose.runtime.Composable +import androidx.compose.runtime.SideEffect +import androidx.compose.ui.graphics.toArgb +import androidx.compose.ui.platform.LocalContext +import androidx.compose.ui.platform.LocalView +import androidx.core.view.WindowCompat + +private val DarkColorScheme = + darkColorScheme( + 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), + */ + ) + +@Composable +fun kreamAndroidTheme( + 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 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, + ) +} diff --git a/app/src/main/java/org/sopt/kream/theme/Type.kt b/app/src/main/java/org/sopt/kream/theme/Type.kt new file mode 100644 index 0000000..405a984 --- /dev/null +++ b/app/src/main/java/org/sopt/kream/theme/Type.kt @@ -0,0 +1,36 @@ +package org.sopt.kream.theme + +import androidx.compose.material3.Typography +import androidx.compose.ui.text.TextStyle +import androidx.compose.ui.text.font.FontFamily +import androidx.compose.ui.text.font.FontWeight +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 + ) + */ + ) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index de38caf..df915a5 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,10 +1,13 @@ [versions] # Kotlin agp = "8.3.2" -kotlin = "1.9.20" +kotlin = "1.9.23" kotlinSerializationJson = "1.5.1" kotlinxCoroutines = "1.7.3" +# Compose +composeBom = "2024.05.00" + # AndroidX appcompat = "1.6.1" coreKtx = "1.13.1" @@ -12,6 +15,7 @@ activity = "1.9.0" constraintlayout = "2.1.4" fragment = "1.7.0" navigation = "2.7.7" +material3Android = "1.2.1" # Test junit = "4.13.2" @@ -33,14 +37,24 @@ retrofitKotlinSerializationConverter = "1.0.0" kotlin-serialization-json = { group = "org.jetbrains.kotlinx", name = "kotlinx-serialization-json", version.ref = "kotlinSerializationJson" } kotlin-coroutines = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-android", version.ref = "kotlinxCoroutines" } -# AdnroidX +# Compose +compose-ui = { group = "androidx.compose.ui", name = "ui" } +compose-ui-graphics = { group = "androidx.compose.ui", name = "ui-graphics" } +compose-ui-tooling-preview = { group = "androidx.compose.ui", name = "ui-tooling-preview" } +compose-meterial3 = { group = "androidx.compose.material3", name = "material3-android", version.ref = "material3Android" } +compose-ui-tooling = { group = "androidx.compose.ui", name = "ui-tooling" } +compose-ui-test-manifest = { group = "androidx.compose.ui", name = "ui-test-manifest" } +compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "composeBom" } + +# AndroidX androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" } androidx-appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" } androidx-activity = { group = "androidx.activity", name = "activity", version.ref = "activity" } androidx-constraintlayout = { group = "androidx.constraintlayout", name = "constraintlayout", version.ref = "constraintlayout" } androidx-fragment = { group = "androidx.fragment", name = "fragment-ktx", version.ref = "fragment" } -androidx-navigation-fragment = { group = "androidx.navigation", name = "navigation-fragment-ktx", version.ref = "navigation"} -androidx-navigation-ui = { group = "androidx.navigation", name = "navigation-ui-ktx", version.ref = "navigation"} +androidx-navigation-fragment = { group = "androidx.navigation", name = "navigation-fragment-ktx", version.ref = "navigation" } +androidx-navigation-ui = { group = "androidx.navigation", name = "navigation-ui-ktx", version.ref = "navigation" } +androidx-activity-compose = { group = "androidx.activity", name = "activity-compose", version.ref = "activity" } # Test junit = { group = "junit", name = "junit", version.ref = "junit" } @@ -78,4 +92,5 @@ androidx = [ ] okhttp = ["okhttp", "okhttp-logging-interceptor"] retrofit = ["retrofit", "retrofit-kotlin-serialization-converter"] +compose = ["androidx-activity-compose", "compose-ui", "compose-ui-graphics", "compose-ui-tooling-preview", "compose-meterial3", "compose-bom"]