Skip to content

Commit 813fad4

Browse files
authored
Merge pull request #360 from Runnect/feature/add-compose-dependency
[ADD] 컴포즈 의존성 추가
2 parents 7fa655c + becfd45 commit 813fad4

File tree

8 files changed

+193
-18
lines changed

8 files changed

+193
-18
lines changed

app/build.gradle

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ plugins {
44

55
id 'kotlin-parcelize'
66

7-
id 'org.jetbrains.kotlin.plugin.serialization' version '1.7.20'
7+
id 'org.jetbrains.kotlin.plugin.serialization' version '1.8.10'
88
id 'dagger.hilt.android.plugin'
99

1010
// plugin for data binding, hilt
@@ -22,12 +22,12 @@ properties.load(project.rootProject.file('local.properties').newDataInputStream(
2222

2323
android {
2424
namespace 'com.runnect.runnect'
25-
compileSdk 33
25+
compileSdk 34
2626

2727
defaultConfig {
2828
applicationId "com.runnect.runnect"
2929
minSdk 28
30-
targetSdk 33
30+
targetSdk 34
3131
versionCode 22
3232
versionName "2.0.1"
3333

@@ -61,6 +61,10 @@ android {
6161

6262
buildFeatures {
6363
buildConfig = true
64+
compose true
65+
}
66+
composeOptions {
67+
kotlinCompilerExtensionVersion '1.4.3'
6468
}
6569

6670
buildTypes {
@@ -150,8 +154,6 @@ dependencies {
150154

151155
//recycler view selection
152156
implementation 'androidx.recyclerview:recyclerview:1.3.0'
153-
implementation 'androidx.recyclerview:recyclerview-selection:1.1.0'
154-
155157

156158
// EncryptedSharedPreferences
157159
implementation "androidx.security:security-crypto-ktx:1.1.0-alpha03"
@@ -181,16 +183,14 @@ dependencies {
181183
// When using the BoM, don't specify versions in Firebase dependencies
182184
implementation 'com.google.firebase:firebase-analytics-ktx'
183185

184-
//kakao share
185-
dependencies {
186-
//카카오 SDK 모듈 설정
187-
implementation "com.kakao.sdk:v2-user:2.15.0" // 카카오 로그인
188-
implementation "com.kakao.sdk:v2-talk:2.15.0" // 친구, 메시지(카카오톡)
189-
implementation "com.kakao.sdk:v2-story:2.15.0" // 카카오스토리
190-
implementation "com.kakao.sdk:v2-link:2.9.0" // 메시지(카카오링크)
191-
implementation "com.kakao.sdk:v2-navi:2.15.0" // 카카오내비
186+
//카카오 SDK
187+
implementation "com.kakao.sdk:v2-user:2.15.0" // 카카오 로그인
188+
implementation "com.kakao.sdk:v2-talk:2.15.0" // 친구, 메시지(카카오톡)
189+
implementation "com.kakao.sdk:v2-story:2.15.0" // 카카오스토리
190+
implementation "com.kakao.sdk:v2-link:2.9.0" // 메시지(카카오링크)
191+
implementation "com.kakao.sdk:v2-navi:2.15.0" // 카카오내비
192+
192193

193-
}
194194
//swipe refresh layout
195195
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0"
196196

@@ -200,4 +200,15 @@ dependencies {
200200
//firebase remote config - update dialog
201201
implementation 'com.google.firebase:firebase-config-ktx'
202202

203+
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.8.2'
204+
implementation 'androidx.activity:activity-compose:1.9.0'
205+
implementation platform('androidx.compose:compose-bom:2023.03.00')
206+
implementation 'androidx.compose.ui:ui'
207+
implementation 'androidx.compose.ui:ui-graphics'
208+
implementation 'androidx.compose.ui:ui-tooling-preview'
209+
implementation 'androidx.compose.material3:material3'
210+
androidTestImplementation platform('androidx.compose:compose-bom:2023.03.00')
211+
androidTestImplementation 'androidx.compose.ui:ui-test-junit4'
212+
debugImplementation 'androidx.compose.ui:ui-tooling'
213+
debugImplementation 'androidx.compose.ui:ui-test-manifest'
203214
}

app/src/main/AndroidManifest.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,9 @@
146146
<activity
147147
android:name=".presentation.profile.ProfileActivity"
148148
android:exported="false" />
149+
<activity
150+
android:name=".presentation.composesample.ComposeSampleActivity"
151+
android:exported="false" />
149152

150153
<provider
151154
android:name="androidx.core.content.FileProvider"
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
package com.runnect.runnect.presentation.composesample
2+
3+
import android.os.Bundle
4+
import androidx.activity.ComponentActivity
5+
import androidx.activity.compose.setContent
6+
import androidx.compose.foundation.layout.fillMaxSize
7+
import androidx.compose.material3.MaterialTheme
8+
import androidx.compose.material3.Surface
9+
import androidx.compose.material3.Text
10+
import androidx.compose.runtime.Composable
11+
import androidx.compose.ui.Modifier
12+
import androidx.compose.ui.tooling.preview.Preview
13+
import com.runnect.runnect.presentation.composesample.ui.theme.ComposeSampleTheme
14+
15+
class ComposeSampleActivity : ComponentActivity() {
16+
override fun onCreate(savedInstanceState: Bundle?) {
17+
super.onCreate(savedInstanceState)
18+
setContent {
19+
ComposeSampleTheme {
20+
// A surface container using the 'background' color from the theme
21+
Surface(
22+
modifier = Modifier.fillMaxSize(),
23+
color = MaterialTheme.colorScheme.background
24+
) {
25+
Greeting("Android")
26+
}
27+
}
28+
}
29+
}
30+
}
31+
32+
@Composable
33+
fun Greeting(name: String, modifier: Modifier = Modifier) {
34+
Text(
35+
text = "Hello $name!",
36+
modifier = modifier
37+
)
38+
}
39+
40+
@Preview(showBackground = true)
41+
@Composable
42+
fun GreetingPreview() {
43+
ComposeSampleTheme {
44+
Greeting("Android")
45+
}
46+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package com.runnect.runnect.presentation.composesample.ui.theme
2+
3+
import androidx.compose.ui.graphics.Color
4+
5+
val Purple80 = Color(0xFFD0BCFF)
6+
val PurpleGrey80 = Color(0xFFCCC2DC)
7+
val Pink80 = Color(0xFFEFB8C8)
8+
9+
val Purple40 = Color(0xFF6650a4)
10+
val PurpleGrey40 = Color(0xFF625b71)
11+
val Pink40 = Color(0xFF7D5260)
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
package com.runnect.runnect.presentation.composesample.ui.theme
2+
3+
import android.app.Activity
4+
import android.os.Build
5+
import androidx.compose.foundation.isSystemInDarkTheme
6+
import androidx.compose.material3.MaterialTheme
7+
import androidx.compose.material3.darkColorScheme
8+
import androidx.compose.material3.dynamicDarkColorScheme
9+
import androidx.compose.material3.dynamicLightColorScheme
10+
import androidx.compose.material3.lightColorScheme
11+
import androidx.compose.runtime.Composable
12+
import androidx.compose.runtime.SideEffect
13+
import androidx.compose.ui.graphics.toArgb
14+
import androidx.compose.ui.platform.LocalContext
15+
import androidx.compose.ui.platform.LocalView
16+
import androidx.core.view.WindowCompat
17+
18+
private val DarkColorScheme = darkColorScheme(
19+
primary = Purple80,
20+
secondary = PurpleGrey80,
21+
tertiary = Pink80
22+
)
23+
24+
private val LightColorScheme = lightColorScheme(
25+
primary = Purple40,
26+
secondary = PurpleGrey40,
27+
tertiary = Pink40
28+
29+
/* Other default colors to override
30+
background = Color(0xFFFFFBFE),
31+
surface = Color(0xFFFFFBFE),
32+
onPrimary = Color.White,
33+
onSecondary = Color.White,
34+
onTertiary = Color.White,
35+
onBackground = Color(0xFF1C1B1F),
36+
onSurface = Color(0xFF1C1B1F),
37+
*/
38+
)
39+
40+
@Composable
41+
fun ComposeSampleTheme(
42+
darkTheme: Boolean = isSystemInDarkTheme(),
43+
// Dynamic color is available on Android 12+
44+
dynamicColor: Boolean = true,
45+
content: @Composable () -> Unit
46+
) {
47+
val colorScheme = when {
48+
dynamicColor && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> {
49+
val context = LocalContext.current
50+
if (darkTheme) dynamicDarkColorScheme(context) else dynamicLightColorScheme(context)
51+
}
52+
53+
darkTheme -> DarkColorScheme
54+
else -> LightColorScheme
55+
}
56+
val view = LocalView.current
57+
if (!view.isInEditMode) {
58+
SideEffect {
59+
val window = (view.context as Activity).window
60+
window.statusBarColor = colorScheme.primary.toArgb()
61+
WindowCompat.getInsetsController(window, view).isAppearanceLightStatusBars = darkTheme
62+
}
63+
}
64+
65+
MaterialTheme(
66+
colorScheme = colorScheme,
67+
typography = Typography,
68+
content = content
69+
)
70+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package com.runnect.runnect.presentation.composesample.ui.theme
2+
3+
import androidx.compose.material3.Typography
4+
import androidx.compose.ui.text.TextStyle
5+
import androidx.compose.ui.text.font.FontFamily
6+
import androidx.compose.ui.text.font.FontWeight
7+
import androidx.compose.ui.unit.sp
8+
9+
// Set of Material typography styles to start with
10+
val Typography = Typography(
11+
bodyLarge = TextStyle(
12+
fontFamily = FontFamily.Default,
13+
fontWeight = FontWeight.Normal,
14+
fontSize = 16.sp,
15+
lineHeight = 24.sp,
16+
letterSpacing = 0.5.sp
17+
)
18+
/* Other default text styles to override
19+
titleLarge = TextStyle(
20+
fontFamily = FontFamily.Default,
21+
fontWeight = FontWeight.Normal,
22+
fontSize = 22.sp,
23+
lineHeight = 28.sp,
24+
letterSpacing = 0.sp
25+
),
26+
labelSmall = TextStyle(
27+
fontFamily = FontFamily.Default,
28+
fontWeight = FontWeight.Medium,
29+
fontSize = 11.sp,
30+
lineHeight = 16.sp,
31+
letterSpacing = 0.5.sp
32+
)
33+
*/
34+
)

app/src/main/java/com/runnect/runnect/presentation/detail/CourseDetailActivity.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ class CourseDetailActivity :
8787
registerBackPressedCallback()
8888
}
8989

90-
override fun onNewIntent(intent: Intent?) {
90+
override fun onNewIntent(intent: Intent) {
9191
super.onNewIntent(intent)
9292
intent?.let { newIntent ->
9393
newIntent.getCompatibleSerializableExtra<CourseDetailRootScreen>(EXTRA_ROOT_SCREEN)

build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ buildscript {
1515
}
1616

1717
plugins {
18-
id 'com.android.application' version '8.0.2' apply false
19-
id 'com.android.library' version '8.0.2' apply false
20-
id 'org.jetbrains.kotlin.android' version '1.7.20' apply false
18+
id 'com.android.application' version '8.1.3' apply false
19+
id 'com.android.library' version '8.1.3' apply false
20+
id 'org.jetbrains.kotlin.android' version '1.8.10' apply false
2121
}

0 commit comments

Comments
 (0)