diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 4572f31b..83904e98 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -1,7 +1,7 @@ plugins { id("chaeum.android.application") id("chaeum.android.compose") - alias(libs.plugins.androidx.navigation.safeargs) + alias(libs.plugins.kotlin.serialization) } android { @@ -32,4 +32,11 @@ dependencies { implementation(libs.androidx.core.splashscreen) implementation(libs.androidx.activity.compose) implementation(libs.androidx.navigation.ui) + implementation(libs.androidx.compose.navigation) + implementation(libs.kotlinx.serialization.json) + + implementation(projects.feature.auth) + implementation(projects.feature.etc) + implementation(projects.feature.matching) + implementation(projects.feature.mypage) } \ No newline at end of file diff --git a/app/src/androidTest/java/com/yapp/chaeum/ExampleInstrumentedTest.kt b/app/src/androidTest/java/com/yapp/chaeum/ExampleInstrumentedTest.kt index 86ed1135..c938cdb2 100644 --- a/app/src/androidTest/java/com/yapp/chaeum/ExampleInstrumentedTest.kt +++ b/app/src/androidTest/java/com/yapp/chaeum/ExampleInstrumentedTest.kt @@ -1,13 +1,11 @@ package com.yapp.chaeum -import androidx.test.platform.app.InstrumentationRegistry import androidx.test.ext.junit.runners.AndroidJUnit4 - +import androidx.test.platform.app.InstrumentationRegistry +import org.junit.Assert.assertEquals import org.junit.Test import org.junit.runner.RunWith -import org.junit.Assert.* - /** * Instrumented test, which will execute on an Android device. * diff --git a/app/src/main/java/com/yapp/chaeum/MainActivity.kt b/app/src/main/java/com/yapp/chaeum/MainActivity.kt index 8bc6911d..391c3563 100644 --- a/app/src/main/java/com/yapp/chaeum/MainActivity.kt +++ b/app/src/main/java/com/yapp/chaeum/MainActivity.kt @@ -4,13 +4,8 @@ import android.os.Bundle import androidx.activity.ComponentActivity import androidx.activity.compose.setContent import androidx.activity.enableEdgeToEdge -import androidx.compose.foundation.layout.fillMaxSize -import androidx.compose.foundation.layout.padding -import androidx.compose.material3.Scaffold -import androidx.compose.material3.Text -import androidx.compose.runtime.Composable -import androidx.compose.ui.Modifier -import androidx.compose.ui.tooling.preview.Preview +import com.yapp.chaeum.ui.App +import com.yapp.chaeum.ui.rememberAppState import com.yapp.chaeum.ui.theme.ChaeumTheme class MainActivity : ComponentActivity() { @@ -18,30 +13,10 @@ class MainActivity : ComponentActivity() { super.onCreate(savedInstanceState) enableEdgeToEdge() setContent { + val appState = rememberAppState() ChaeumTheme { - Scaffold(modifier = Modifier.fillMaxSize()) { innerPadding -> - Greeting( - name = "Android", - modifier = Modifier.padding(innerPadding) - ) - } + App(appState) } } } -} - -@Composable -fun Greeting(name: String, modifier: Modifier = Modifier) { - Text( - text = "Hello $name!", - modifier = modifier - ) -} - -@Preview(showBackground = true) -@Composable -fun GreetingPreview() { - ChaeumTheme { - Greeting("Android") - } } \ No newline at end of file diff --git a/app/src/main/java/com/yapp/chaeum/navigation/AppNavHost.kt b/app/src/main/java/com/yapp/chaeum/navigation/AppNavHost.kt new file mode 100644 index 00000000..55372587 --- /dev/null +++ b/app/src/main/java/com/yapp/chaeum/navigation/AppNavHost.kt @@ -0,0 +1,32 @@ +package com.yapp.chaeum.navigation + +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.navigation.compose.NavHost +import com.example.auth.navigation.AuthGraph +import com.example.auth.navigation.authNavGraph +import com.example.matching.navigation.navigateToMatchingDetailRoute +import com.yapp.chaeum.navigation.home.homeNavGraph +import com.yapp.chaeum.ui.AppState + +@Composable +fun AppNavHost( + appState: AppState, + modifier: Modifier = Modifier, +) { + val navController = appState.navController + + NavHost( + navController = navController, + startDestination = AuthGraph, + ) { + authNavGraph( + onLoginSuccess = appState::navigateToHome, + ) + homeNavGraph( + onNavigateToDetail = navController::navigateToMatchingDetailRoute, + onBack = navController::popBackStack, + modifier = modifier, + ) + } +} diff --git a/app/src/main/java/com/yapp/chaeum/navigation/TopLevelDestinvation.kt b/app/src/main/java/com/yapp/chaeum/navigation/TopLevelDestinvation.kt new file mode 100644 index 00000000..f3458097 --- /dev/null +++ b/app/src/main/java/com/yapp/chaeum/navigation/TopLevelDestinvation.kt @@ -0,0 +1,44 @@ +package com.yapp.chaeum.navigation + +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.filled.Call +import androidx.compose.material.icons.outlined.Call +import androidx.compose.ui.graphics.vector.ImageVector +import com.example.etc.navigation.EtcRoute +import com.example.matching.navigation.MatchingGraphDest +import com.example.mypage.navigation.MyPageRoute +import kotlin.reflect.KClass + +enum class TopLevelDestination( + val selectedIcon: ImageVector, + val unselectedIcon: ImageVector, + val iconText: String, + val titleText: String, + val route: KClass<*>, +) { + MATCHING( + selectedIcon = Icons.Filled.Call, + unselectedIcon = Icons.Outlined.Call, + iconText = "매칭", + titleText = "매칭", + route = MatchingGraphDest.MatchingRoute::class, + ), + MYPAGE( + selectedIcon = Icons.Filled.Call, + unselectedIcon = Icons.Outlined.Call, + iconText = "마이페이지", + titleText = "마이페이지", + route = MyPageRoute::class, + ), + ETC( + selectedIcon = Icons.Filled.Call, + unselectedIcon = Icons.Outlined.Call, + iconText = "ETC", + titleText = "ETC", + route = EtcRoute::class, + ); + + companion object { + val topLevelDestinations = entries + } +} diff --git a/app/src/main/java/com/yapp/chaeum/navigation/home/HomeNavigation.kt b/app/src/main/java/com/yapp/chaeum/navigation/home/HomeNavigation.kt new file mode 100644 index 00000000..2d03f608 --- /dev/null +++ b/app/src/main/java/com/yapp/chaeum/navigation/home/HomeNavigation.kt @@ -0,0 +1,29 @@ +package com.yapp.chaeum.navigation.home + +import androidx.compose.ui.Modifier +import androidx.navigation.NavGraphBuilder +import androidx.navigation.navigation +import com.example.etc.navigation.etcScreen +import com.example.matching.navigation.MatchingGraph +import com.example.matching.navigation.matchingNavGraph +import com.example.mypage.navigation.myPageScreen +import kotlinx.serialization.Serializable + +@Serializable +data object HomeGraph + +fun NavGraphBuilder.homeNavGraph( + onNavigateToDetail: () -> Unit, + onBack: () -> Unit, + modifier: Modifier = Modifier, +) { + navigation(startDestination = MatchingGraph) { + matchingNavGraph( + onNavigateToDetail = onNavigateToDetail, + onBack = onBack, + modifier = modifier, + ) + myPageScreen(modifier) + etcScreen(modifier) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/yapp/chaeum/ui/App.kt b/app/src/main/java/com/yapp/chaeum/ui/App.kt new file mode 100644 index 00000000..5062f7d3 --- /dev/null +++ b/app/src/main/java/com/yapp/chaeum/ui/App.kt @@ -0,0 +1,82 @@ +package com.yapp.chaeum.ui + +import androidx.compose.foundation.layout.navigationBarsPadding +import androidx.compose.foundation.layout.padding +import androidx.compose.material.BottomNavigation +import androidx.compose.material.BottomNavigationItem +import androidx.compose.material.Icon +import androidx.compose.material.Text +import androidx.compose.material3.Scaffold +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.navigation.NavDestination +import androidx.navigation.NavDestination.Companion.hasRoute +import androidx.navigation.NavDestination.Companion.hierarchy +import com.example.auth.navigation.AuthGraph +import com.yapp.chaeum.navigation.AppNavHost +import com.yapp.chaeum.navigation.TopLevelDestination +import kotlin.reflect.KClass + +@Composable +fun App( + appState: AppState = rememberAppState(), + modifier: Modifier = Modifier, +) { + val currentDestination = appState.currentDestination + + Scaffold( + bottomBar = { + if (currentDestination?.isInAuthGraph() == false) { + AppBottomBar(appState, currentDestination) + } + } + ) { innerPadding -> + val contentModifier = modifier.padding(innerPadding) + AppNavHost( + appState = appState, + modifier = contentModifier, + ) + } +} + +@Composable +private fun AppBottomBar( + appState: AppState, + currentDestination: NavDestination? +) { + BottomNavigation( + modifier = Modifier.navigationBarsPadding() + ) { + TopLevelDestination.topLevelDestinations.forEach { topLevelRoute -> + BottomNavigationItem( + icon = { + Icon( + imageVector = topLevelRoute.selectedIcon, + contentDescription = topLevelRoute.name + ) + }, + label = { Text(topLevelRoute.name) }, + selected = currentDestination.isRouteInHierarchy(topLevelRoute.route), + onClick = { + appState.navigateToTopLevelDestination(topLevelRoute) + } + ) + } + } +} + +/** + * 현재 목적지가 AuthGraph 인지 확인하는 메서드 + */ +private fun NavDestination?.isInAuthGraph(): Boolean = + this?.hierarchy?.any { destination -> + destination.route == AuthGraph::class.qualifiedName + } ?: false + +/** + * 현재 목적지가 TopLeveLDestination 라우트에 속하는지 확인하는 메서드 + */ +private fun NavDestination?.isRouteInHierarchy(route: KClass<*>): Boolean = + this?.hierarchy?.any { + it.hasRoute(route) + } ?: false \ No newline at end of file diff --git a/app/src/main/java/com/yapp/chaeum/ui/AppState.kt b/app/src/main/java/com/yapp/chaeum/ui/AppState.kt new file mode 100644 index 00000000..c60d484a --- /dev/null +++ b/app/src/main/java/com/yapp/chaeum/ui/AppState.kt @@ -0,0 +1,60 @@ +package com.yapp.chaeum.ui + +import androidx.compose.runtime.Composable +import androidx.compose.runtime.remember +import androidx.navigation.NavDestination +import androidx.navigation.NavHostController +import androidx.navigation.compose.currentBackStackEntryAsState +import androidx.navigation.compose.rememberNavController +import androidx.navigation.navOptions +import com.example.auth.navigation.AuthGraphDest +import com.example.etc.navigation.navigateToEtc +import com.example.matching.navigation.navigateToMatchingGraph +import com.example.mypage.navigation.navigateToMyPage +import com.yapp.chaeum.navigation.TopLevelDestination +import com.yapp.chaeum.navigation.home.HomeGraph + +@Composable +fun rememberAppState( + navController: NavHostController = rememberNavController(), +): AppState { + return remember(navController) { + AppState(navController = navController) + } +} + +class AppState( + val navController: NavHostController, +) { + val currentDestination: NavDestination? + @Composable get() = navController + .currentBackStackEntryAsState().value?.destination + + fun navigateToHome() { + navController.navigate(HomeGraph) { + popUpTo(AuthGraphDest.AuthRoute) { + inclusive = true + } + launchSingleTop = true + restoreState = true + } + } + + fun navigateToTopLevelDestination( + topLevelDestination: TopLevelDestination, + ) { + val topLevelNavOptions = navOptions { + popUpTo(HomeGraph) { + saveState = true + } + launchSingleTop = true + restoreState = true + } + + when (topLevelDestination) { + TopLevelDestination.MATCHING -> navController.navigateToMatchingGraph(topLevelNavOptions) + TopLevelDestination.MYPAGE -> navController.navigateToMyPage(topLevelNavOptions) + TopLevelDestination.ETC -> navController.navigateToEtc(topLevelNavOptions) + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/yapp/chaeum/ui/theme/Theme.kt b/app/src/main/java/com/yapp/chaeum/ui/theme/Theme.kt index 0eba5f58..dec6301f 100644 --- a/app/src/main/java/com/yapp/chaeum/ui/theme/Theme.kt +++ b/app/src/main/java/com/yapp/chaeum/ui/theme/Theme.kt @@ -1,6 +1,5 @@ package com.yapp.chaeum.ui.theme -import android.app.Activity import android.os.Build import androidx.compose.foundation.isSystemInDarkTheme import androidx.compose.material3.MaterialTheme diff --git a/app/src/test/java/com/yapp/chaeum/ExampleUnitTest.kt b/app/src/test/java/com/yapp/chaeum/ExampleUnitTest.kt index c35f9ac8..e11269b8 100644 --- a/app/src/test/java/com/yapp/chaeum/ExampleUnitTest.kt +++ b/app/src/test/java/com/yapp/chaeum/ExampleUnitTest.kt @@ -1,9 +1,8 @@ package com.yapp.chaeum +import org.junit.Assert.assertEquals import org.junit.Test -import org.junit.Assert.* - /** * Example local unit test, which will execute on the development machine (host). * diff --git a/build-logic/src/main/java/com/yapp/build/logic/KotlinAndroid.kt b/build-logic/src/main/java/com/yapp/build/logic/KotlinAndroid.kt index afdf4a9e..8330dca4 100644 --- a/build-logic/src/main/java/com/yapp/build/logic/KotlinAndroid.kt +++ b/build-logic/src/main/java/com/yapp/build/logic/KotlinAndroid.kt @@ -2,7 +2,6 @@ package com.yapp.build.logic import org.gradle.api.JavaVersion import org.gradle.api.Project -import org.gradle.kotlin.dsl.dependencies import org.gradle.kotlin.dsl.provideDelegate import org.gradle.kotlin.dsl.withType import org.jetbrains.kotlin.gradle.dsl.JvmTarget diff --git a/build-logic/src/main/java/com/yapp/build/logic/chaeum.android.feature.gradle.kts b/build-logic/src/main/java/com/yapp/build/logic/chaeum.android.feature.gradle.kts index ac8cdd5a..ac679704 100644 --- a/build-logic/src/main/java/com/yapp/build/logic/chaeum.android.feature.gradle.kts +++ b/build-logic/src/main/java/com/yapp/build/logic/chaeum.android.feature.gradle.kts @@ -4,6 +4,7 @@ import com.yapp.build.logic.libs plugins { id("chaeum.android.library") id("chaeum.android.compose") +// id("org.jetbrains.kotlin.plugin.serialization") } android { @@ -22,6 +23,7 @@ dependencies { // implementation(project(":core:common-ui")) val libs = project.extensions.libs + implementation(libs.findLibrary("kotlinx.serialization.json").get()) implementation(libs.findLibrary("androidx.compose.navigation").get()) implementation(libs.findLibrary("androidx.lifecycle.viewModelCompose").get()) implementation(libs.findLibrary("androidx.lifecycle.runtimeCompose").get()) diff --git a/feature/auth/.gitignore b/feature/auth/.gitignore new file mode 100644 index 00000000..42afabfd --- /dev/null +++ b/feature/auth/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/feature/auth/build.gradle.kts b/feature/auth/build.gradle.kts new file mode 100644 index 00000000..7f0b1ff3 --- /dev/null +++ b/feature/auth/build.gradle.kts @@ -0,0 +1,8 @@ +plugins { + id("chaeum.android.feature") + alias(libs.plugins.kotlin.serialization) +} + +android { + namespace = "com.chaeum.auth" +} \ No newline at end of file diff --git a/feature/auth/consumer-rules.pro b/feature/auth/consumer-rules.pro new file mode 100644 index 00000000..e69de29b diff --git a/feature/auth/proguard-rules.pro b/feature/auth/proguard-rules.pro new file mode 100644 index 00000000..481bb434 --- /dev/null +++ b/feature/auth/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/feature/auth/src/androidTest/java/com/example/auth/ExampleInstrumentedTest.kt b/feature/auth/src/androidTest/java/com/example/auth/ExampleInstrumentedTest.kt new file mode 100644 index 00000000..47f4217e --- /dev/null +++ b/feature/auth/src/androidTest/java/com/example/auth/ExampleInstrumentedTest.kt @@ -0,0 +1,22 @@ +package com.example.auth + +import androidx.test.ext.junit.runners.AndroidJUnit4 +import androidx.test.platform.app.InstrumentationRegistry +import org.junit.Assert.assertEquals +import org.junit.Test +import org.junit.runner.RunWith + +/** + * 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.example.auth.test", appContext.packageName) + } +} \ No newline at end of file diff --git a/feature/auth/src/main/AndroidManifest.xml b/feature/auth/src/main/AndroidManifest.xml new file mode 100644 index 00000000..44008a43 --- /dev/null +++ b/feature/auth/src/main/AndroidManifest.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/feature/auth/src/main/java/com/example/auth/AuthScreen.kt b/feature/auth/src/main/java/com/example/auth/AuthScreen.kt new file mode 100644 index 00000000..4eab93e5 --- /dev/null +++ b/feature/auth/src/main/java/com/example/auth/AuthScreen.kt @@ -0,0 +1,26 @@ +package com.example.auth + +import androidx.compose.foundation.clickable +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.material.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.unit.sp + +@Composable +fun AuthRoute( + onLoginSuccess: () -> Unit, +) { + Box(modifier = Modifier.fillMaxSize(), contentAlignment = Alignment.Center) { + Text( + text = "AuthRoute", + fontSize = 30.sp, + modifier = Modifier.clickable { onLoginSuccess() }) + } +} + +@Composable +fun AuthScreen() { +} \ No newline at end of file diff --git a/feature/auth/src/main/java/com/example/auth/navigation/AuthNavigation.kt b/feature/auth/src/main/java/com/example/auth/navigation/AuthNavigation.kt new file mode 100644 index 00000000..7d54471b --- /dev/null +++ b/feature/auth/src/main/java/com/example/auth/navigation/AuthNavigation.kt @@ -0,0 +1,32 @@ +package com.example.auth.navigation + +import androidx.navigation.NavController +import androidx.navigation.NavGraphBuilder +import androidx.navigation.NavOptions +import androidx.navigation.compose.composable +import androidx.navigation.navigation +import com.example.auth.AuthRoute +import kotlinx.serialization.Serializable + +@Serializable +data object AuthGraph + +sealed class AuthGraphDest { + @Serializable + data object AuthRoute : AuthGraphDest() +} + +fun NavController.navigateToAuth(navOptions: NavOptions) = + navigate(route = AuthGraphDest.AuthRoute, navOptions) + +fun NavGraphBuilder.authNavGraph( + onLoginSuccess: () -> Unit, +) { + navigation(startDestination = AuthGraphDest.AuthRoute) { + composable { + AuthRoute( + onLoginSuccess = onLoginSuccess + ) + } + } +} \ No newline at end of file diff --git a/feature/auth/src/test/java/com/example/auth/ExampleUnitTest.kt b/feature/auth/src/test/java/com/example/auth/ExampleUnitTest.kt new file mode 100644 index 00000000..a127c830 --- /dev/null +++ b/feature/auth/src/test/java/com/example/auth/ExampleUnitTest.kt @@ -0,0 +1,16 @@ +package com.example.auth + +import org.junit.Assert.assertEquals +import org.junit.Test + +/** + * 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) + } +} \ No newline at end of file diff --git a/feature/etc/.gitignore b/feature/etc/.gitignore new file mode 100644 index 00000000..42afabfd --- /dev/null +++ b/feature/etc/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/feature/etc/build.gradle.kts b/feature/etc/build.gradle.kts new file mode 100644 index 00000000..a025060a --- /dev/null +++ b/feature/etc/build.gradle.kts @@ -0,0 +1,8 @@ +plugins { + id("chaeum.android.feature") + alias(libs.plugins.kotlin.serialization) +} + +android { + namespace = "com.chaeum.etc" +} \ No newline at end of file diff --git a/feature/etc/consumer-rules.pro b/feature/etc/consumer-rules.pro new file mode 100644 index 00000000..e69de29b diff --git a/feature/etc/proguard-rules.pro b/feature/etc/proguard-rules.pro new file mode 100644 index 00000000..481bb434 --- /dev/null +++ b/feature/etc/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/feature/etc/src/androidTest/java/com/example/etc/ExampleInstrumentedTest.kt b/feature/etc/src/androidTest/java/com/example/etc/ExampleInstrumentedTest.kt new file mode 100644 index 00000000..aef3f6fc --- /dev/null +++ b/feature/etc/src/androidTest/java/com/example/etc/ExampleInstrumentedTest.kt @@ -0,0 +1,22 @@ +package com.example.etc + +import androidx.test.ext.junit.runners.AndroidJUnit4 +import androidx.test.platform.app.InstrumentationRegistry +import org.junit.Assert.assertEquals +import org.junit.Test +import org.junit.runner.RunWith + +/** + * 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.example.etc.test", appContext.packageName) + } +} \ No newline at end of file diff --git a/feature/etc/src/main/AndroidManifest.xml b/feature/etc/src/main/AndroidManifest.xml new file mode 100644 index 00000000..44008a43 --- /dev/null +++ b/feature/etc/src/main/AndroidManifest.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/feature/etc/src/main/java/com/example/etc/EtcScreen.kt b/feature/etc/src/main/java/com/example/etc/EtcScreen.kt new file mode 100644 index 00000000..118a1f38 --- /dev/null +++ b/feature/etc/src/main/java/com/example/etc/EtcScreen.kt @@ -0,0 +1,22 @@ +package com.example.etc + +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.material.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.unit.sp + +@Composable +fun EtcRoute( + modifier: Modifier = Modifier, +) { + Box(modifier = modifier.fillMaxSize(), contentAlignment = Alignment.Center) { + Text(text = "EtcRoute", fontSize = 30.sp) + } +} + +@Composable +internal fun EtcScreen() { +} \ No newline at end of file diff --git a/feature/etc/src/main/java/com/example/etc/navigation/EtcNavigation.kt b/feature/etc/src/main/java/com/example/etc/navigation/EtcNavigation.kt new file mode 100644 index 00000000..6158954f --- /dev/null +++ b/feature/etc/src/main/java/com/example/etc/navigation/EtcNavigation.kt @@ -0,0 +1,21 @@ +package com.example.etc.navigation + +import androidx.compose.ui.Modifier +import androidx.navigation.NavController +import androidx.navigation.NavGraphBuilder +import androidx.navigation.NavOptions +import androidx.navigation.compose.composable +import com.example.etc.EtcRoute +import kotlinx.serialization.Serializable + +@Serializable +object EtcRoute + +fun NavController.navigateToEtc(navOptions: NavOptions) = + navigate(route = EtcRoute, navOptions) + +fun NavGraphBuilder.etcScreen(modifier: Modifier = Modifier) { + composable { + EtcRoute(modifier) + } +} diff --git a/feature/etc/src/test/java/com/example/etc/ExampleUnitTest.kt b/feature/etc/src/test/java/com/example/etc/ExampleUnitTest.kt new file mode 100644 index 00000000..a09e411c --- /dev/null +++ b/feature/etc/src/test/java/com/example/etc/ExampleUnitTest.kt @@ -0,0 +1,16 @@ +package com.example.etc + +import org.junit.Assert.assertEquals +import org.junit.Test + +/** + * 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) + } +} \ No newline at end of file diff --git a/feature/matching/.gitignore b/feature/matching/.gitignore new file mode 100644 index 00000000..42afabfd --- /dev/null +++ b/feature/matching/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/feature/matching/build.gradle.kts b/feature/matching/build.gradle.kts new file mode 100644 index 00000000..f149b982 --- /dev/null +++ b/feature/matching/build.gradle.kts @@ -0,0 +1,8 @@ +plugins { + id("chaeum.android.feature") + alias(libs.plugins.kotlin.serialization) +} + +android { + namespace = "com.chaeum.matching" +} \ No newline at end of file diff --git a/feature/matching/consumer-rules.pro b/feature/matching/consumer-rules.pro new file mode 100644 index 00000000..e69de29b diff --git a/feature/matching/proguard-rules.pro b/feature/matching/proguard-rules.pro new file mode 100644 index 00000000..481bb434 --- /dev/null +++ b/feature/matching/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/feature/matching/src/androidTest/java/com/example/matching/ExampleInstrumentedTest.kt b/feature/matching/src/androidTest/java/com/example/matching/ExampleInstrumentedTest.kt new file mode 100644 index 00000000..f0dc667d --- /dev/null +++ b/feature/matching/src/androidTest/java/com/example/matching/ExampleInstrumentedTest.kt @@ -0,0 +1,22 @@ +package com.example.matching + +import androidx.test.ext.junit.runners.AndroidJUnit4 +import androidx.test.platform.app.InstrumentationRegistry +import org.junit.Assert.assertEquals +import org.junit.Test +import org.junit.runner.RunWith + +/** + * 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.example.matching.test", appContext.packageName) + } +} \ No newline at end of file diff --git a/feature/matching/src/main/AndroidManifest.xml b/feature/matching/src/main/AndroidManifest.xml new file mode 100644 index 00000000..44008a43 --- /dev/null +++ b/feature/matching/src/main/AndroidManifest.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/feature/matching/src/main/java/com/example/matching/MatchingScreen.kt b/feature/matching/src/main/java/com/example/matching/MatchingScreen.kt new file mode 100644 index 00000000..cf401d77 --- /dev/null +++ b/feature/matching/src/main/java/com/example/matching/MatchingScreen.kt @@ -0,0 +1,29 @@ +package com.example.matching + +import androidx.compose.foundation.clickable +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.material.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.unit.sp + +@Composable +fun MatchingRoute( + onNavigateToDetail: () -> Unit, + modifier: Modifier = Modifier, +) { + Box( + modifier = modifier + .fillMaxSize() + .clickable { onNavigateToDetail() }, + contentAlignment = Alignment.Center + ) { + Text(text = "MatchingRoute", fontSize = 30.sp) + } +} + +@Composable +internal fun MatchingScreen() { +} \ No newline at end of file diff --git a/feature/matching/src/main/java/com/example/matching/detail/MatchingDetailRoute.kt b/feature/matching/src/main/java/com/example/matching/detail/MatchingDetailRoute.kt new file mode 100644 index 00000000..300e1cd0 --- /dev/null +++ b/feature/matching/src/main/java/com/example/matching/detail/MatchingDetailRoute.kt @@ -0,0 +1,25 @@ +package com.example.matching.detail + +import androidx.compose.foundation.clickable +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.material.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.unit.sp + +@Composable +fun MatchingDetailRoute( + onBack: () -> Unit, + modifier: Modifier = Modifier, +) { + Box( + modifier = modifier + .fillMaxSize() + .clickable { onBack() }, + contentAlignment = Alignment.Center + ) { + Text(text = "MatchingDetailRoute", fontSize = 30.sp) + } +} \ No newline at end of file diff --git a/feature/matching/src/main/java/com/example/matching/navigation/MatchingNavigation.kt b/feature/matching/src/main/java/com/example/matching/navigation/MatchingNavigation.kt new file mode 100644 index 00000000..ab873755 --- /dev/null +++ b/feature/matching/src/main/java/com/example/matching/navigation/MatchingNavigation.kt @@ -0,0 +1,54 @@ +package com.example.matching.navigation + +import androidx.compose.ui.Modifier +import androidx.navigation.NavController +import androidx.navigation.NavGraphBuilder +import androidx.navigation.NavOptions +import androidx.navigation.compose.composable +import androidx.navigation.navigation +import com.example.matching.MatchingRoute +import com.example.matching.detail.MatchingDetailRoute +import kotlinx.serialization.Serializable + + +@Serializable +data object MatchingGraph + +sealed class MatchingGraphDest { + @Serializable + data object MatchingRoute : MatchingGraphDest() + + @Serializable + data object MatchingDetailRoute : MatchingGraphDest() +} + +fun NavController.navigateToMatchingGraph(navOptions: NavOptions) = + navigate(route = MatchingGraph, navOptions) + +fun NavController.navigateToMatchingDetailRoute() = + navigate(MatchingGraphDest.MatchingDetailRoute) + +fun NavGraphBuilder.matchingNavGraph( + onNavigateToDetail: () -> Unit, + onBack: () -> Unit, + modifier: Modifier = Modifier, +) { + navigation( + startDestination = MatchingGraphDest.MatchingRoute, + ) { + /** 예시 코드, 삭제 예정 */ + composable { + MatchingRoute( + onNavigateToDetail = onNavigateToDetail, + modifier = modifier, + ) + } + + composable { + MatchingDetailRoute( + onBack = onBack, + modifier = modifier, + ) + } + } +} \ No newline at end of file diff --git a/feature/matching/src/test/java/com/example/matching/ExampleUnitTest.kt b/feature/matching/src/test/java/com/example/matching/ExampleUnitTest.kt new file mode 100644 index 00000000..71d22f0e --- /dev/null +++ b/feature/matching/src/test/java/com/example/matching/ExampleUnitTest.kt @@ -0,0 +1,16 @@ +package com.example.matching + +import org.junit.Assert.assertEquals +import org.junit.Test + +/** + * 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) + } +} \ No newline at end of file diff --git a/feature/mypage/.gitignore b/feature/mypage/.gitignore new file mode 100644 index 00000000..42afabfd --- /dev/null +++ b/feature/mypage/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/feature/mypage/build.gradle.kts b/feature/mypage/build.gradle.kts new file mode 100644 index 00000000..60e7176f --- /dev/null +++ b/feature/mypage/build.gradle.kts @@ -0,0 +1,8 @@ +plugins { + id("chaeum.android.feature") + alias(libs.plugins.kotlin.serialization) +} + +android { + namespace = "com.chaeum.mypage" +} \ No newline at end of file diff --git a/feature/mypage/consumer-rules.pro b/feature/mypage/consumer-rules.pro new file mode 100644 index 00000000..e69de29b diff --git a/feature/mypage/proguard-rules.pro b/feature/mypage/proguard-rules.pro new file mode 100644 index 00000000..481bb434 --- /dev/null +++ b/feature/mypage/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/feature/mypage/src/androidTest/java/com/example/mypage/ExampleInstrumentedTest.kt b/feature/mypage/src/androidTest/java/com/example/mypage/ExampleInstrumentedTest.kt new file mode 100644 index 00000000..959a8f88 --- /dev/null +++ b/feature/mypage/src/androidTest/java/com/example/mypage/ExampleInstrumentedTest.kt @@ -0,0 +1,22 @@ +package com.example.mypage + +import androidx.test.ext.junit.runners.AndroidJUnit4 +import androidx.test.platform.app.InstrumentationRegistry +import org.junit.Assert.assertEquals +import org.junit.Test +import org.junit.runner.RunWith + +/** + * 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.example.mypage.test", appContext.packageName) + } +} \ No newline at end of file diff --git a/feature/mypage/src/main/AndroidManifest.xml b/feature/mypage/src/main/AndroidManifest.xml new file mode 100644 index 00000000..44008a43 --- /dev/null +++ b/feature/mypage/src/main/AndroidManifest.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/feature/mypage/src/main/java/com/example/mypage/MyPageScreen.kt b/feature/mypage/src/main/java/com/example/mypage/MyPageScreen.kt new file mode 100644 index 00000000..aedb5a9f --- /dev/null +++ b/feature/mypage/src/main/java/com/example/mypage/MyPageScreen.kt @@ -0,0 +1,22 @@ +package com.example.mypage + +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.material.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.unit.sp + +@Composable +fun MyPageRoute( + modifier: Modifier = Modifier, +) { + Box(modifier = modifier.fillMaxSize(), contentAlignment = Alignment.Center) { + Text(text = "MyPageRoute", fontSize = 30.sp) + } +} + +@Composable +internal fun MyPageScreen() { +} \ No newline at end of file diff --git a/feature/mypage/src/main/java/com/example/mypage/navigation/MyPageNavigation.kt b/feature/mypage/src/main/java/com/example/mypage/navigation/MyPageNavigation.kt new file mode 100644 index 00000000..42c6779c --- /dev/null +++ b/feature/mypage/src/main/java/com/example/mypage/navigation/MyPageNavigation.kt @@ -0,0 +1,21 @@ +package com.example.mypage.navigation + +import androidx.compose.ui.Modifier +import androidx.navigation.NavController +import androidx.navigation.NavGraphBuilder +import androidx.navigation.NavOptions +import androidx.navigation.compose.composable +import com.example.mypage.MyPageRoute +import kotlinx.serialization.Serializable + +@Serializable +object MyPageRoute + +fun NavController.navigateToMyPage(navOptions: NavOptions) = + navigate(route = MyPageRoute, navOptions) + +fun NavGraphBuilder.myPageScreen(modifier: Modifier = Modifier) { + composable { + MyPageRoute(modifier) + } +} diff --git a/feature/mypage/src/test/java/com/example/mypage/ExampleUnitTest.kt b/feature/mypage/src/test/java/com/example/mypage/ExampleUnitTest.kt new file mode 100644 index 00000000..c5faf91b --- /dev/null +++ b/feature/mypage/src/test/java/com/example/mypage/ExampleUnitTest.kt @@ -0,0 +1,16 @@ +package com.example.mypage + +import org.junit.Assert.assertEquals +import org.junit.Test + +/** + * 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) + } +} \ No newline at end of file diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 6ee8dfcd..c5afaac1 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -26,7 +26,7 @@ androidxSplashscreen = "1.0.1" # https://developer.android.com/develop/ui/compose/bom/bom-mapping androidxComposeBom = "2024.11.00" # https://developer.android.com/jetpack/androidx/releases/navigation -androidxComposeNavigation = "2.8.3" +androidxComposeNavigation = "2.8.4" # https://developer.android.com/jetpack/androidx/releases/compose-material androidxComposeMaterial = "1.7.4" # https://developer.android.com/jetpack/androidx/releases/compose-material3 diff --git a/local.properties b/local.properties index 6d528639..23ab913d 100644 --- a/local.properties +++ b/local.properties @@ -1,10 +1,8 @@ -## This file is automatically generated by Android Studio. -# Do not modify this file -- YOUR CHANGES WILL BE ERASED! -# -# This file should *NOT* be checked into Version Control Systems, +## This file must *NOT* be checked into Version Control Systems, # as it contains information specific to your local configuration. # # Location of the SDK. This is only used by Gradle. # For customization when using a Version Control System, please read the # header note. -sdk.dir=/Users/antaegyu/Library/Android/sdk \ No newline at end of file +#Mon Dec 09 00:43:52 KST 2024 +sdk.dir=C\:\\Users\\sksow\\AppData\\Local\\Android\\Sdk diff --git a/settings.gradle.kts b/settings.gradle.kts index ff0d480e..12f6b79a 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -23,3 +23,7 @@ dependencyResolutionManagement { rootProject.name = "Chaeum" include(":app") +include(":feature:auth") +include(":feature:mypage") +include(":feature:matching") +include(":feature:etc")