forked from mash-up-kr/ssam-d-Android
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[feat] mash-up-kr#111 Home화면 route 및 graph 생성
- Loading branch information
1 parent
a1f8a6d
commit 5ebede5
Showing
4 changed files
with
112 additions
and
0 deletions.
There are no files selected for viewing
55 changes: 55 additions & 0 deletions
55
presentation/src/main/java/com/mashup/presentation/feature/home/navigation/HomeNavigation.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package com.mashup.presentation.feature.home.navigation | ||
|
||
import androidx.navigation.NavController | ||
import androidx.navigation.NavGraphBuilder | ||
import androidx.navigation.NavOptions | ||
import androidx.navigation.compose.composable | ||
import androidx.navigation.compose.navigation | ||
import com.mashup.presentation.navigation.KeyLinkNavigationRoute | ||
|
||
/** | ||
* Ssam_D_Android | ||
* @author jaesung | ||
* @created 2023/07/04 | ||
*/ | ||
fun NavController.navigateToGuideRoute(navOptions: NavOptions? = null) { | ||
navigate( | ||
route = KeyLinkNavigationRoute.HomeGraph.GuideRoute.route, | ||
navOptions = navOptions | ||
) | ||
} | ||
|
||
fun NavController.navigateToEditKeywordRoute(navOptions: NavOptions? = null) { | ||
navigate( | ||
route = KeyLinkNavigationRoute.HomeGraph.EditKeywordRoute.route, | ||
navOptions = navOptions | ||
) | ||
} | ||
|
||
fun NavController.navigateToProfileRoute(navOptions: NavOptions? = null) { | ||
navigate( | ||
route = KeyLinkNavigationRoute.HomeGraph.ProfileRoute.route, | ||
navOptions = navOptions | ||
) | ||
} | ||
|
||
fun NavGraphBuilder.homeGraph() { | ||
navigation( | ||
route = KeyLinkNavigationRoute.HomeGraph.route, | ||
startDestination = KeyLinkNavigationRoute.HomeGraph.HomeRoute.route | ||
) { | ||
composable(route = KeyLinkNavigationRoute.HomeGraph.HomeRoute.route) { | ||
// HomeRoute | ||
} | ||
composable(route = KeyLinkNavigationRoute.HomeGraph.GuideRoute.route) { | ||
// GuideRoute | ||
} | ||
composable(route = KeyLinkNavigationRoute.HomeGraph.EditKeywordRoute.route) { | ||
// KeywordRoute | ||
} | ||
composable(route = KeyLinkNavigationRoute.HomeGraph.ProfileRoute.route) { | ||
// ProfileRoute | ||
} | ||
} | ||
|
||
} |
29 changes: 29 additions & 0 deletions
29
presentation/src/main/java/com/mashup/presentation/navigation/KeyLinkNavHost.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package com.mashup.presentation.navigation | ||
|
||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.navigation.compose.NavHost | ||
import com.mashup.presentation.KeyLinkAppState | ||
import com.mashup.presentation.feature.home.navigation.homeGraph | ||
|
||
/** | ||
* Ssam_D_Android | ||
* @author jaesung | ||
* @created 2023/07/04 | ||
*/ | ||
@Composable | ||
fun KeyLinkNavHost( | ||
appState: KeyLinkAppState, | ||
onShowSnackbar: suspend (String, String?) -> Boolean, | ||
startDestination: String, | ||
modifier: Modifier = Modifier | ||
) { | ||
val navController = appState.navController | ||
NavHost( | ||
navController = navController, | ||
startDestination = startDestination, | ||
modifier = modifier | ||
) { | ||
homeGraph() | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
presentation/src/main/java/com/mashup/presentation/navigation/KeyLinkNavigationRoute.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.mashup.presentation.navigation | ||
|
||
/** | ||
* Ssam_D_Android | ||
* @author jaesung | ||
* @created 2023/07/04 | ||
*/ | ||
sealed class KeyLinkNavigationRoute(val route: String) { | ||
object HomeGraph : KeyLinkNavigationRoute(homeGraphPattern) { | ||
object HomeRoute : KeyLinkNavigationRoute(homeRoute) | ||
object EditKeywordRoute : KeyLinkNavigationRoute(editKeywordRoute) | ||
object GuideRoute : KeyLinkNavigationRoute(guideRoute) | ||
object ProfileRoute : KeyLinkNavigationRoute(profileRoute) | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
presentation/src/main/java/com/mashup/presentation/navigation/RouteConst.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.mashup.presentation.navigation | ||
|
||
/** | ||
* Ssam_D_Android | ||
* @author jaesung | ||
* @created 2023/07/04 | ||
*/ | ||
|
||
const val homeGraphPattern = "home_graph" | ||
const val homeRoute = "home_graph/home" | ||
const val guideRoute = "home_graph/guide" | ||
const val profileRoute = "home_graph/profile" | ||
const val editKeywordRoute = "home_graph/edit_keyword" |