diff --git a/app/build.gradle.kts b/app/build.gradle.kts index a5a33bbde..7fc81dff0 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -57,6 +57,7 @@ dependencies { implementation(project(":feature:signin")) implementation(project(":feature:signup")) implementation(project(":feature:home")) + implementation(project(":feature:alarm")) implementation(platform(libs.androidx.compose.bom)) implementation(libs.jobis.design.system) diff --git a/app/src/main/java/team/retum/jobisandroidv2/navigation/MainNavigation.kt b/app/src/main/java/team/retum/jobisandroidv2/navigation/MainNavigation.kt index 313dc674b..a18fb92ff 100644 --- a/app/src/main/java/team/retum/jobisandroidv2/navigation/MainNavigation.kt +++ b/app/src/main/java/team/retum/jobisandroidv2/navigation/MainNavigation.kt @@ -1,17 +1,20 @@ package team.retum.jobisandroidv2.navigation import androidx.navigation.NavGraphBuilder +import androidx.navigation.NavHostController import androidx.navigation.navigation +import team.retum.alarm.navigation.alarm import team.retum.jobisandroidv2.root.NAVIGATION_ROOT import team.retum.jobisandroidv2.root.root const val NAVIGATION_MAIN = "main" -fun NavGraphBuilder.mainNavigation() { +fun NavGraphBuilder.mainNavigation(navHostController: NavHostController) { navigation( route = NAVIGATION_MAIN, startDestination = NAVIGATION_ROOT, ) { - root() + root(navHostController = navHostController) + alarm(onBackPressed = navHostController::popBackStack) } } diff --git a/app/src/main/java/team/retum/jobisandroidv2/root/RootNavigation.kt b/app/src/main/java/team/retum/jobisandroidv2/root/RootNavigation.kt index 0b0e6b6c5..2bcaa3ee1 100644 --- a/app/src/main/java/team/retum/jobisandroidv2/root/RootNavigation.kt +++ b/app/src/main/java/team/retum/jobisandroidv2/root/RootNavigation.kt @@ -2,13 +2,14 @@ package team.retum.jobisandroidv2.root import androidx.navigation.NavController import androidx.navigation.NavGraphBuilder +import androidx.navigation.NavHostController import androidx.navigation.compose.composable const val NAVIGATION_ROOT = "root" -fun NavGraphBuilder.root() { +fun NavGraphBuilder.root(navHostController: NavHostController) { composable(NAVIGATION_ROOT) { - Root() + Root(navHostController = navHostController) } } diff --git a/app/src/main/java/team/retum/jobisandroidv2/root/RootScreen.kt b/app/src/main/java/team/retum/jobisandroidv2/root/RootScreen.kt index a7c0a951f..67c5dd723 100644 --- a/app/src/main/java/team/retum/jobisandroidv2/root/RootScreen.kt +++ b/app/src/main/java/team/retum/jobisandroidv2/root/RootScreen.kt @@ -3,23 +3,31 @@ package team.retum.jobisandroidv2.root import android.annotation.SuppressLint import androidx.compose.material3.Scaffold import androidx.compose.runtime.Composable +import androidx.navigation.NavController import androidx.navigation.NavHostController import androidx.navigation.compose.NavHost import androidx.navigation.compose.rememberNavController +import team.retum.alarm.navigation.navigateToAlarm import team.retum.home.navigation.NAVIGATION_HOME import team.retum.home.navigation.home import team.retum.jobisandroidv2.ui.BottomNavigationBar @Composable -fun Root() { +fun Root(navHostController: NavHostController) { val navController = rememberNavController() - RootScreen(navController = navController) + RootScreen( + navController = navController, + navHostController = navHostController, + ) } @SuppressLint("UnusedMaterial3ScaffoldPaddingParameter") @Composable -private fun RootScreen(navController: NavHostController) { +private fun RootScreen( + navController: NavHostController, + navHostController: NavController, +) { Scaffold( bottomBar = { BottomNavigationBar(navController = navController) }, ) { @@ -27,7 +35,7 @@ private fun RootScreen(navController: NavHostController) { navController = navController, startDestination = NAVIGATION_HOME, ) { - home() + home(onAlarmClick = navHostController::navigateToAlarm) } } } diff --git a/app/src/main/java/team/retum/jobisandroidv2/ui/JobisApp.kt b/app/src/main/java/team/retum/jobisandroidv2/ui/JobisApp.kt index 9ca62deb2..963566929 100644 --- a/app/src/main/java/team/retum/jobisandroidv2/ui/JobisApp.kt +++ b/app/src/main/java/team/retum/jobisandroidv2/ui/JobisApp.kt @@ -22,6 +22,6 @@ internal fun JobisApp() { startDestination = NAVIGATION_AUTH, ) { authNavigation(navController = navController) - mainNavigation() + mainNavigation(navHostController = navController) } } diff --git a/feature/.DS_Store b/feature/.DS_Store new file mode 100644 index 000000000..3e555fe82 Binary files /dev/null and b/feature/.DS_Store differ diff --git a/feature/alarm/.gitignore b/feature/alarm/.gitignore new file mode 100644 index 000000000..42afabfd2 --- /dev/null +++ b/feature/alarm/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/feature/alarm/build.gradle.kts b/feature/alarm/build.gradle.kts new file mode 100644 index 000000000..577a55ce7 --- /dev/null +++ b/feature/alarm/build.gradle.kts @@ -0,0 +1,20 @@ +@Suppress("DSL_SCOPE_VIOLATION") // TODO: Remove once KTIJ-19369 is fixed +plugins { + id(libs.plugins.android.library.get().pluginId) + id(libs.plugins.kotlin.android.get().pluginId) + id(libs.plugins.hilt.android.get().pluginId) + id(libs.plugins.kotlin.kapt.get().pluginId) +} + +apply() +apply() + +android { + namespace = "team.retum.alarm" +} + +dependencies { + + implementation(project(":core:common")) + implementation(project(":core:domain")) +} diff --git a/feature/alarm/src/androidTest/java/team/retum/alarm/ExampleInstrumentedTest.kt b/feature/alarm/src/androidTest/java/team/retum/alarm/ExampleInstrumentedTest.kt new file mode 100644 index 000000000..cf6b15354 --- /dev/null +++ b/feature/alarm/src/androidTest/java/team/retum/alarm/ExampleInstrumentedTest.kt @@ -0,0 +1,22 @@ +package team.retum.alarm + +import androidx.test.ext.junit.runners.AndroidJUnit4 +import androidx.test.platform.app.InstrumentationRegistry +import junit.framework.TestCase.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("team.retum.alarm.test", appContext.packageName) + } +} diff --git a/feature/alarm/src/main/java/team/retum/alarm/navigation/AlarmNavigation.kt b/feature/alarm/src/main/java/team/retum/alarm/navigation/AlarmNavigation.kt new file mode 100644 index 000000000..94d1ba14c --- /dev/null +++ b/feature/alarm/src/main/java/team/retum/alarm/navigation/AlarmNavigation.kt @@ -0,0 +1,18 @@ +package team.retum.alarm.navigation + +import androidx.navigation.NavController +import androidx.navigation.NavGraphBuilder +import androidx.navigation.compose.composable +import team.retum.alarm.ui.Alarm + +const val NAVIGATION_ALARM = "alarm" + +fun NavGraphBuilder.alarm(onBackPressed: () -> Unit) { + composable(NAVIGATION_ALARM) { + Alarm(onBackPressed = onBackPressed) + } +} + +fun NavController.navigateToAlarm() { + navigate(NAVIGATION_ALARM) +} diff --git a/feature/alarm/src/main/java/team/retum/alarm/ui/AlarmScreen.kt b/feature/alarm/src/main/java/team/retum/alarm/ui/AlarmScreen.kt new file mode 100644 index 000000000..af8b1e064 --- /dev/null +++ b/feature/alarm/src/main/java/team/retum/alarm/ui/AlarmScreen.kt @@ -0,0 +1,99 @@ +package team.retum.alarm.ui + +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.fillMaxHeight +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.rememberScrollState +import androidx.compose.foundation.verticalScroll +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.res.stringResource +import androidx.compose.ui.unit.dp +import team.retum.alarm.R +import team.returm.jobisdesignsystemv2.appbar.JobisSmallTopAppBar +import team.returm.jobisdesignsystemv2.foundation.JobisTheme +import team.returm.jobisdesignsystemv2.foundation.JobisTypography + +// TODO 서버 연동 시 제거 +private data class AlarmData( + val companyName: String, + val content: String, + val date: String, +) + +@Composable +internal fun Alarm( + onBackPressed: () -> Unit, +) { + val alarmList = emptyList() + AlarmScreen( + onBackPressed = onBackPressed, + alarmList = alarmList, + ) +} + +@Composable +private fun AlarmScreen( + onBackPressed: () -> Unit, + alarmList: List, +) { + Column( + modifier = Modifier + .fillMaxSize() + .background(JobisTheme.colors.background) + .padding(horizontal = 24.dp), + ) { + JobisSmallTopAppBar( + title = stringResource(id = R.string.alarm), + onBackPressed = onBackPressed, + ) + Column( + modifier = Modifier + .fillMaxSize() + .verticalScroll(rememberScrollState()), + ) { + alarmList.forEach { + AlarmContent( + companyName = it.companyName, + content = it.content, + date = it.date, + ) + } + } + } +} + +@Composable +fun AlarmContent( + companyName: String, + content: String, + date: String, +) { + Column( + modifier = Modifier + .fillMaxHeight(0.14f) + .padding(vertical = 16.dp), + ) { + Text( + text = companyName, + style = JobisTypography.Description, + color = JobisTheme.colors.onPrimary, + ) + Text( + text = content, + style = JobisTypography.HeadLine, + color = JobisTheme.colors.onBackground, + ) + Spacer(modifier = Modifier.height(4.dp)) + Text( + text = date, + style = JobisTypography.Description, + color = JobisTheme.colors.onSurfaceVariant, + ) + } +} \ No newline at end of file diff --git a/feature/alarm/src/main/res/values/strings.xml b/feature/alarm/src/main/res/values/strings.xml new file mode 100644 index 000000000..c416ded52 --- /dev/null +++ b/feature/alarm/src/main/res/values/strings.xml @@ -0,0 +1,4 @@ + + + 알림 + \ No newline at end of file diff --git a/feature/alarm/src/test/java/team/retum/alarm/ExampleUnitTest.kt b/feature/alarm/src/test/java/team/retum/alarm/ExampleUnitTest.kt new file mode 100644 index 000000000..d4277e7ef --- /dev/null +++ b/feature/alarm/src/test/java/team/retum/alarm/ExampleUnitTest.kt @@ -0,0 +1,16 @@ +package team.retum.alarm + +import junit.framework.TestCase.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) + } +} diff --git a/feature/home/src/main/java/team/retum/home/navigation/HomeNavigation.kt b/feature/home/src/main/java/team/retum/home/navigation/HomeNavigation.kt index 67954cc13..ad55e7018 100644 --- a/feature/home/src/main/java/team/retum/home/navigation/HomeNavigation.kt +++ b/feature/home/src/main/java/team/retum/home/navigation/HomeNavigation.kt @@ -6,8 +6,8 @@ import team.retum.home.ui.Home const val NAVIGATION_HOME = "home" -fun NavGraphBuilder.home() { +fun NavGraphBuilder.home(onAlarmClick: () -> Unit) { composable(NAVIGATION_HOME) { - Home() + Home(onAlarmClick = onAlarmClick) } } diff --git a/feature/home/src/main/java/team/retum/home/ui/HomeScreen.kt b/feature/home/src/main/java/team/retum/home/ui/HomeScreen.kt index 3d5850405..2b9096f01 100644 --- a/feature/home/src/main/java/team/retum/home/ui/HomeScreen.kt +++ b/feature/home/src/main/java/team/retum/home/ui/HomeScreen.kt @@ -75,7 +75,7 @@ private data class ApplyCompany( @OptIn(ExperimentalFoundationApi::class) @Composable -fun Home() { +fun Home(onAlarmClick: () -> Unit) { val pagerState = rememberPagerState(INITIAL_PAGE) { MAX_PAGE } val menus = listOf( MenuItem( @@ -93,6 +93,7 @@ fun Home() { HomeScreen( pagerState = pagerState, menus = menus, + onAlarmClick = onAlarmClick, ) } @@ -101,6 +102,7 @@ fun Home() { private fun HomeScreen( pagerState: PagerState, menus: List, + onAlarmClick: () -> Unit, ) { Column( modifier = Modifier @@ -112,7 +114,7 @@ private fun HomeScreen( JobisIconButton( painter = painterResource(JobisIcon.Bell), contentDescription = "notification", - onClick = {}, + onClick = onAlarmClick, ) } Column(modifier = Modifier.verticalScroll(rememberScrollState())) { diff --git a/feature/landing/src/main/java/team/retum/landing/navigation/LandingNavigation.kt b/feature/landing/src/main/java/team/retum/landing/navigation/LandingNavigation.kt index 680edd54f..7af3226d7 100644 --- a/feature/landing/src/main/java/team/retum/landing/navigation/LandingNavigation.kt +++ b/feature/landing/src/main/java/team/retum/landing/navigation/LandingNavigation.kt @@ -10,7 +10,7 @@ fun NavGraphBuilder.landing( onSignInClick: () -> Unit, onSignUpClick: () -> Unit, ) { - composable(route = NAVIGATION_LANDING) { + composable(NAVIGATION_LANDING) { Landing( onSignInClick = onSignInClick, onSignUpClick = onSignUpClick, diff --git a/feature/signin/src/main/java/team/retum/signin/navigation/SignInNavigation.kt b/feature/signin/src/main/java/team/retum/signin/navigation/SignInNavigation.kt index 61408c5ae..2be52b6cf 100644 --- a/feature/signin/src/main/java/team/retum/signin/navigation/SignInNavigation.kt +++ b/feature/signin/src/main/java/team/retum/signin/navigation/SignInNavigation.kt @@ -11,7 +11,7 @@ fun NavGraphBuilder.signIn( onBackPressed: () -> Unit, onSignInSuccess: () -> Unit, ) { - composable(route = NAVIGATION_SIGN_IN) { + composable(NAVIGATION_SIGN_IN) { SignIn( onBackClick = onBackPressed, onSignInSuccess = onSignInSuccess, diff --git a/settings.gradle.kts b/settings.gradle.kts index 07bbe9464..200b55f73 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -26,3 +26,4 @@ include(":feature:landing") include(":feature:signin") include(":feature:signup") include(":feature:home") +include(":feature:alarm")