Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 22 additions & 11 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import java.util.Properties
plugins {
// ์ปค์Šคํ…€ ํ”Œ๋Ÿฌ๊ทธ์ธ ์ ์šฉ
id("barrion.android.application")
id("barrion.android.application.compose") // ์ƒˆ๋กœ์šด Compose ํ”Œ๋Ÿฌ๊ทธ์ธ ์‚ฌ์šฉ
id("org.jetbrains.kotlin.plugin.compose") // Compose ์ปดํŒŒ์ผ๋Ÿฌ ํ”Œ๋Ÿฌ๊ทธ์ธ ์ถ”๊ฐ€
id("barrion.hilt") // ์˜์กด์„ฑ ์ฃผ์ž…
id("barrion.network") // ๋„คํŠธ์›Œํ‚น
id("barrion.imageloading") // ์ด๋ฏธ์ง€ ๋กœ๋”ฉ
id("barrion.android.application.compose")
id("org.jetbrains.kotlin.plugin.compose")
id("barrion.hilt")
id("barrion.network")
id("barrion.imageloading")
}

val properties =
Expand All @@ -24,13 +24,21 @@ android {
targetSdk = 34
versionCode = 1
versionName = "1.0"

// ๋ฆฌ์†Œ์Šค ์ตœ์ ํ™” ์„ค์ •
resourceConfigurations.addAll(listOf("en", "ko"))
}

// ๋™์  ๊ธฐ๋Šฅ ๋ชจ๋“ˆ ๊ด€๋ จ ์„ค์ • ์ถ”๊ฐ€
// ์˜จ๋ณด๋”ฉ ๋ชจ๋“ˆ์ด ๋™์  ๊ธฐ๋Šฅ ๋ชจ๋“ˆ๋กœ ๊ตฌ์„ฑ๋˜์–ด ์žˆ๋‹ค๋ฉด ์‚ฌ์šฉ
// dynamicFeatures += setOf(":feature:onboarding")

buildFeatures {
compose = true
}

composeOptions {
kotlinCompilerExtensionVersion = "1.5.10" // libs.versions.toml์— ์ •์˜๋œ ๊ฐ’ ๋˜๋Š” ์ง์ ‘ ๋ช…์‹œ
kotlinCompilerExtensionVersion = "1.5.10"
}

buildTypes {
Expand All @@ -43,16 +51,15 @@ android {
}
}

// Java ๋ฒ„์ „ ์˜ค๋ฒ„๋ผ์ด๋“œ (ํ”Œ๋Ÿฌ๊ทธ์ธ์—์„œ 17 ์‚ฌ์šฉ, ์•ฑ์—์„œ 11๋กœ ๋ณ€๊ฒฝ)
compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

kotlinOptions {
jvmTarget = "11"
}

// ๋นŒ๋“œ ๊ธฐ๋Šฅ ์„ค์ • (ํ•„์š”ํ•œ ๊ฒฝ์šฐ)
buildFeatures {
viewBinding = true
dataBinding = true
Expand All @@ -61,17 +68,21 @@ android {
}

dependencies {
// ์•ฑ ํŠนํ™” ์˜์กด์„ฑ๋งŒ ์ถ”๊ฐ€ (ํ”Œ๋Ÿฌ๊ทธ์ธ์—์„œ ์ฒ˜๋ฆฌํ•˜์ง€ ์•Š๋Š” ์˜์กด์„ฑ)
// ๊ธฐ์กด ์˜์กด์„ฑ ์œ ์ง€
implementation(project(":core:ui"))
implementation(project(":presentation"))
implementation(project(":feature:onboarding"))

implementation("androidx.core:core-splashscreen:1.0.1")
implementation("androidx.navigation:navigation-compose:2.7.5")
implementation(libs.balloon)
implementation(libs.core.splashscreen)

// ํ…Œ์ŠคํŠธ ์˜์กด์„ฑ (ํ…Œ์ŠคํŠธ ํ”Œ๋Ÿฌ๊ทธ์ธ์ด ์—†๋Š” ๊ฒฝ์šฐ)
testImplementation(libs.junit)
androidTestImplementation(libs.androidx.junit)
androidTestImplementation(libs.androidx.espresso.core)
}


//import java.util.Properties
//
//plugins {
Expand Down
26 changes: 13 additions & 13 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
xmlns:tools="http://schemas.android.com/tools">

<application
android:name=".BarrionApplication"
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
Expand All @@ -12,17 +13,16 @@
android:supportsRtl="true"
android:theme="@style/Theme.Barrion"
tools:targetApi="31">
<activity
android:name=".MainActivity"
android:exported="true"
android:label="@string/app_name"
android:theme="@style/Theme.Barrion">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<activity
android:name=".MainActivity"
android:exported="true"
android:label="@string/app_name"
android:theme="@style/Theme.Barrion.Splash">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

</manifest>
</manifest>
Binary file added app/src/main/ic_launcher-playstore.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions app/src/main/java/com/example/barrion/BarrionApplication.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// app/src/main/java/com/example/barrion/BarrionApplication.kt

package com.example.barrion

import android.app.Application
import dagger.hilt.android.HiltAndroidApp

/**
* ์•ฑ์˜ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ํด๋ž˜์Šค
* Hilt ์˜์กด์„ฑ ์ฃผ์ž…์„ ์œ„ํ•œ ์ง„์ž…์  ์—ญํ• ์„ ํ•ฉ๋‹ˆ๋‹ค.
*
* @HiltAndroidApp ์–ด๋…ธํ…Œ์ด์…˜์€ Hilt์˜ ์ฝ”๋“œ ์ƒ์„ฑ์„ ํŠธ๋ฆฌ๊ฑฐํ•˜๊ณ 
* ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ์ˆ˜์ค€์˜ ์˜์กด์„ฑ ์ปจํ…Œ์ด๋„ˆ๋ฅผ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค.
*/
@HiltAndroidApp
class BarrionApplication : Application() {
// ์•ฑ ์‹œ์ž‘ ์‹œ ์ดˆ๊ธฐํ™”๊ฐ€ ํ•„์š”ํ•œ ์ฝ”๋“œ๋ฅผ ์—ฌ๊ธฐ์— ์ถ”๊ฐ€ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
// ์˜ˆ: ๋กœ๊น… ์„ค์ •, ํฌ๋ž˜์‹œ ๋ฆฌํฌํŒ… ๋„๊ตฌ ์ดˆ๊ธฐํ™”, ๊ธ€๋กœ๋ฒŒ ์„ค์ • ๋“ฑ
}
94 changes: 65 additions & 29 deletions app/src/main/java/com/example/barrion/MainActivity.kt
Original file line number Diff line number Diff line change
@@ -1,50 +1,86 @@
// app/src/main/java/com/example/barrion/MainActivity.kt

package com.example.barrion

import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import androidx.activity.viewModels
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.material3.Surface
import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
import com.example.barrion.ui.theme.BarrionTheme
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
import androidx.lifecycle.lifecycleScope
import com.example.presentation.splash.SplashViewModel
import androidx.navigation.compose.rememberNavController
import com.example.barrion.navigation.BarrionNavHost
import com.example.ui.theme.BarrionTheme
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.flow.collectLatest
import kotlinx.coroutines.launch

/**
* ์•ฑ์˜ ๋ฉ”์ธ ์•กํ‹ฐ๋น„ํ‹ฐ
* ์•ฑ์˜ ์‹œ์ž‘์ ์ด๋ฉฐ Compose ๊ธฐ๋ฐ˜ UI๋ฅผ ์„ค์ •ํ•ฉ๋‹ˆ๋‹ค.
*
* @AndroidEntryPoint ์–ด๋…ธํ…Œ์ด์…˜์€ Hilt์˜ ์˜์กด์„ฑ ์ฃผ์ž…์„ ์ด ์•กํ‹ฐ๋น„ํ‹ฐ์— ์ ์šฉํ•ฉ๋‹ˆ๋‹ค.
*/
@AndroidEntryPoint
class MainActivity : ComponentActivity() {

// Hilt๋ฅผ ํ†ตํ•ด SplashViewModel ์˜์กด์„ฑ ์ฃผ์ž…
private val viewModel: SplashViewModel by viewModels()

override fun onCreate(savedInstanceState: Bundle?) {
// ์Šคํ”Œ๋ž˜์‹œ ์Šคํฌ๋ฆฐ ์„ค์ • - Android 12+ ์Šคํ”Œ๋ž˜์‹œ ํ™”๋ฉด API ์‚ฌ์šฉ
val splashScreen = installSplashScreen()

// ๋ทฐ๋ชจ๋ธ์˜ ์ดˆ๊ธฐํ™” ์ƒํƒœ์— ๋”ฐ๋ผ ์Šคํ”Œ๋ž˜์‹œ ํ™”๋ฉด ํ‘œ์‹œ ์‹œ๊ฐ„ ์กฐ์ ˆ
// isInitialized.value๊ฐ€ true๊ฐ€ ๋  ๋•Œ๊นŒ์ง€ ์Šคํ”Œ๋ž˜์‹œ ํ™”๋ฉด ์œ ์ง€
splashScreen.setKeepOnScreenCondition {
!viewModel.isInitialized.value
}

super.onCreate(savedInstanceState)

// ์—ฃ์ง€ํˆฌ์—ฃ์ง€ ๋””์Šคํ”Œ๋ ˆ์ด ํ™œ์„ฑํ™” - ์ „์ฒด ํ™”๋ฉด ์‚ฌ์šฉ
enableEdgeToEdge()

// ์•ฑ ์ดˆ๊ธฐํ™” ์ƒํƒœ ๊ด€์ฐฐ ๋ฐ ์ฒ˜๋ฆฌ
lifecycleScope.launch {
// ๋ทฐ๋ชจ๋ธ์˜ ์ดˆ๊ธฐํ™” ์ƒํƒœ๋ฅผ ๊ด€์ฐฐํ•˜์—ฌ ํ•„์š”ํ•œ ์ž‘์—… ์ˆ˜ํ–‰
viewModel.isInitialized.collectLatest { isInitialized ->
if (isInitialized) {
// ์ดˆ๊ธฐํ™”๊ฐ€ ์™„๋ฃŒ๋œ ํ›„ ์ˆ˜ํ–‰ํ•  ์ž‘์—…
// ์˜ˆ: ๋กœ๊ทธ์ธ ์ƒํƒœ ํ™•์ธ, ๋ฐ์ดํ„ฐ ํ”„๋ฆฌ๋กœ๋“œ ๋“ฑ
}
}
}

// Compose UI ์„ค์ •
setContent {
// ์•ฑ์˜ ํ…Œ๋งˆ ์ ์šฉ
BarrionTheme {
Scaffold(modifier = Modifier.fillMaxSize()) { innerPadding ->
Greeting(
name = "A222",
modifier = Modifier.padding(innerPadding),
)
// ์Šค์บํด๋“œ๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ๊ธฐ๋ณธ ๋ ˆ์ด์•„์›ƒ ๊ตฌ์„ฑ
Scaffold { innerPadding ->
Surface(
modifier = Modifier
.fillMaxSize()
.padding(innerPadding),
color = MaterialTheme.colorScheme.background
) {
// ๋„ค๋น„๊ฒŒ์ด์…˜ ์ปจํŠธ๋กค๋Ÿฌ ์ƒ์„ฑ
val navController = rememberNavController()

// ์•ฑ์˜ ๋ฉ”์ธ ๋„ค๋น„๊ฒŒ์ด์…˜ ์„ค์ •
BarrionNavHost(navController = navController)
}
}
}
}
}
}

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

@Preview(showBackground = true)
@Composable
fun GreetingPreview() {
BarrionTheme {
Greeting("Android")
}
}
}
89 changes: 89 additions & 0 deletions app/src/main/java/com/example/barrion/navigation/BarrionNavHost.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
// app/src/main/java/com/example/barrion/navigation/BarrionNavHost.kt

package com.example.barrion.navigation

import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.navigation.NavHostController
import androidx.navigation.compose.NavHost
import androidx.navigation.compose.composable
import com.example.onboarding.presentation.OnboardingScreen

/**
* ์•ฑ์˜ ๋ฉ”์ธ ๋„ค๋น„๊ฒŒ์ด์…˜ ํ˜ธ์ŠคํŠธ
* ๋ชจ๋“  ํ™”๋ฉด ๊ฐ„์˜ ์ด๋™์„ ๊ด€๋ฆฌํ•ฉ๋‹ˆ๋‹ค.
*
* @param navController ํ™”๋ฉด ์ „ํ™˜์„ ์œ„ํ•œ ๋„ค๋น„๊ฒŒ์ด์…˜ ์ปจํŠธ๋กค๋Ÿฌ
*/
@Composable
fun BarrionNavHost(navController: NavHostController) {
// ์•ฑ์˜ ๋ชจ๋“  ํ™”๋ฉด ๊ฐ„ ๋„ค๋น„๊ฒŒ์ด์…˜์„ ์„ค์ •
NavHost(
navController = navController,
startDestination = NavRoutes.Onboarding.route // ์‹œ์ž‘ ํ™”๋ฉด์„ ์˜จ๋ณด๋”ฉ์œผ๋กœ ์„ค์ •
) {
// ์˜จ๋ณด๋”ฉ ํ™”๋ฉด ๋ผ์šฐํŠธ
composable(route = NavRoutes.Onboarding.route) {
OnboardingScreen(
onNavigateToHome = {
// ํ™ˆ ํ™”๋ฉด์œผ๋กœ ์ด๋™ํ•˜๋ฉด์„œ ์˜จ๋ณด๋”ฉ ํ™”๋ฉด์€ ๋ฐฑ์Šคํƒ์—์„œ ์ œ๊ฑฐ
navController.navigate(NavRoutes.Home.route) {
popUpTo(NavRoutes.Onboarding.route) { inclusive = true }
}
}
)
}

// ํ™ˆ ํ™”๋ฉด ๋ผ์šฐํŠธ (๋ฉ”๋‰ด ๊ด€๋ฆฌ ํ™”๋ฉด)
composable(route = NavRoutes.Home.route) {
// ํ˜„์žฌ ๊ตฌํ˜„ ์˜ˆ์ •์ธ ํ™”๋ฉด - ๊ตฌํ˜„ ํ›„ ์ฃผ์„ ํ•ด์ œ
// MenuScreen(
// onNavigateToOrder = { navController.navigate(NavRoutes.Order.route) },
// onNavigateToSales = { navController.navigate(NavRoutes.Sales.route) },
// onNavigateToStaff = { navController.navigate(NavRoutes.Staff.route) }
// )

// ์ž„์‹œ๋กœ ๊ฐœ๋ฐœ ์ค‘ ๋ฉ”์‹œ์ง€ ํ‘œ์‹œ
Box(
modifier = Modifier.fillMaxSize(),
contentAlignment = Alignment.Center
) {
Text(
text = "์•ฑ ๊ฐœ๋ฐœ ์ค‘...",
style = MaterialTheme.typography.headlineMedium
)
}
}

// ์ฃผ๋ฌธ ๊ด€๋ฆฌ ํ™”๋ฉด ๋ผ์šฐํŠธ
composable(route = NavRoutes.Order.route) {
// ํ˜„์žฌ ๊ตฌํ˜„ ์˜ˆ์ •์ธ ํ™”๋ฉด - ๊ตฌํ˜„ ํ›„ ์ฃผ์„ ํ•ด์ œ
// OrderScreen(
// onNavigateBack = { navController.popBackStack() }
// )
}

// ๋งค์ถœ ํ™”๋ฉด ๋ผ์šฐํŠธ
composable(route = NavRoutes.Sales.route) {
// ํ˜„์žฌ ๊ตฌํ˜„ ์˜ˆ์ •์ธ ํ™”๋ฉด - ๊ตฌํ˜„ ํ›„ ์ฃผ์„ ํ•ด์ œ
// SalesScreen(
// onNavigateBack = { navController.popBackStack() }
// )
}

// ์ง์› ๊ด€๋ฆฌ ํ™”๋ฉด ๋ผ์šฐํŠธ
composable(route = NavRoutes.Staff.route) {
// ํ˜„์žฌ ๊ตฌํ˜„ ์˜ˆ์ •์ธ ํ™”๋ฉด - ๊ตฌํ˜„ ํ›„ ์ฃผ์„ ํ•ด์ œ
// StaffScreen(
// onNavigateBack = { navController.popBackStack() }
// )
}

// ์ถ”๊ฐ€ ํ™”๋ฉด๋“ค..
}
}
Loading