Skip to content

Commit 42e2dd1

Browse files
authored
Merge pull request #23 from YAPP-Github/refactor/#22-single-activity
LoginActivity 제거 및 MainActivity로 진입점 통일
2 parents 167ddcc + 6a2d793 commit 42e2dd1

File tree

11 files changed

+141
-29
lines changed

11 files changed

+141
-29
lines changed

app/src/main/AndroidManifest.xml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,17 @@
77
android:icon="@mipmap/ic_launcher"
88
android:label="@string/app_name"
99
android:roundIcon="@mipmap/ic_launcher_round"
10-
android:supportsRtl="true">
10+
android:supportsRtl="true"
11+
android:theme="@style/Theme.Twix">
12+
13+
<activity
14+
android:name=".main.MainActivity"
15+
android:exported="true">
16+
17+
<intent-filter>
18+
<action android:name="android.intent.action.MAIN"/>
19+
<category android:name="android.intent.category.LAUNCHER" />
20+
</intent-filter>
21+
</activity>
1122
</application>
1223
</manifest>
Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
package com.yapp.twix
22

33
import android.app.Application
4-
import org.koin.android.ext.koin.androidContext
5-
import org.koin.core.context.startKoin
4+
import com.yapp.twix.di.initKoin
65

76
class TwixApplication : Application() {
87
override fun onCreate() {
98
super.onCreate()
109

11-
startKoin {
12-
androidContext(this@TwixApplication)
13-
modules()
14-
}
10+
initKoin(
11+
context = this
12+
)
1513
}
1614
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package com.yapp.twix.di
2+
3+
import com.twix.login.di.loginModule
4+
import org.koin.core.module.Module
5+
6+
val featureModules: List<Module> = listOf(
7+
loginModule
8+
)
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package com.yapp.twix.di
2+
3+
import android.content.Context
4+
import org.koin.android.ext.koin.androidContext
5+
import org.koin.core.context.startKoin
6+
import org.koin.core.module.Module
7+
8+
fun initKoin(
9+
context: Context? = null,
10+
extraModules: List<Module> = emptyList()
11+
) {
12+
startKoin {
13+
context?.let { androidContext(it) }
14+
15+
modules(
16+
buildList {
17+
addAll(extraModules)
18+
addAll(featureModules)
19+
}
20+
)
21+
}
22+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package com.yapp.twix.main
2+
3+
import android.os.Bundle
4+
import androidx.activity.ComponentActivity
5+
import androidx.activity.compose.setContent
6+
import androidx.compose.foundation.layout.Box
7+
import androidx.compose.foundation.layout.fillMaxSize
8+
import androidx.compose.foundation.layout.safeContentPadding
9+
import androidx.compose.ui.Modifier
10+
import com.twix.navigation.AppNavHost
11+
12+
class MainActivity: ComponentActivity() {
13+
override fun onCreate(savedInstanceState: Bundle?) {
14+
super.onCreate(savedInstanceState)
15+
16+
setContent {
17+
// TODO: 디자인 시스템이 결정되면 테마 구현 및 적용
18+
Box(
19+
modifier = Modifier
20+
.safeContentPadding()
21+
.fillMaxSize()
22+
) {
23+
AppNavHost()
24+
}
25+
}
26+
}
27+
}

build-logic/convention/src/main/kotlin/com/twix/convention/AndroidApplicationConventionPlugin.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,21 @@ import com.twix.convention.extension.configureAndroid
66
import com.twix.convention.extension.implementation
77
import com.twix.convention.extension.library
88
import com.twix.convention.extension.libs
9+
import com.twix.convention.extension.version
10+
import org.gradle.kotlin.dsl.apply
911
import org.gradle.kotlin.dsl.configure
1012
import org.gradle.kotlin.dsl.dependencies
1113

1214
class AndroidApplicationConventionPlugin : BuildLogicConventionPlugin({
1315
applyPlugins("com.android.application", "org.jetbrains.kotlin.android")
16+
apply<AndroidComposeConventionPlugin>()
1417

1518
extensions.configure<ApplicationExtension> {
1619
configureAndroid(this)
20+
21+
defaultConfig {
22+
targetSdk = libs.version("targetSdk").requiredVersion.toInt()
23+
}
1724
}
1825

1926
dependencies {

feature/login/src/main/AndroidManifest.xml

Lines changed: 0 additions & 12 deletions
This file was deleted.

feature/login/src/main/java/com/twix/login/LoginActivity.kt

Lines changed: 0 additions & 10 deletions
This file was deleted.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package com.twix.login
2+
3+
import androidx.compose.foundation.layout.Box
4+
import androidx.compose.foundation.layout.fillMaxSize
5+
import androidx.compose.material3.Text
6+
import androidx.compose.runtime.Composable
7+
import androidx.compose.ui.Alignment
8+
import androidx.compose.ui.Modifier
9+
10+
@Composable
11+
fun LoginScreen() {
12+
LoginContent()
13+
}
14+
15+
@Composable
16+
private fun LoginContent() {
17+
Box(
18+
modifier = Modifier.fillMaxSize(),
19+
contentAlignment = Alignment.Center
20+
) {
21+
Text("임시 화면입니다.")
22+
}
23+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package com.twix.login.di
2+
3+
import com.twix.login.navigation.LoginNavGraph
4+
import com.twix.navigation.NavRoutes
5+
import com.twix.navigation.base.NavGraphContributor
6+
import org.koin.core.qualifier.named
7+
import org.koin.dsl.module
8+
9+
val loginModule = module {
10+
single<NavGraphContributor>(named(NavRoutes.LoginGraph.route)) { LoginNavGraph }
11+
}

0 commit comments

Comments
 (0)