From 8deaf5625ba0f753b7aaf6cad0a99d1beddafe0d Mon Sep 17 00:00:00 2001 From: Hyobeen-Park Date: Fri, 24 Jan 2025 08:24:58 +0900 Subject: [PATCH] =?UTF-8?q?[FEAT/#162]=20=EB=84=A4=EB=B9=84=EA=B2=8C?= =?UTF-8?q?=EC=9D=B4=EC=85=98=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/spoony/spoony/presentation/main/MainScreen.kt | 3 ++- .../spoony/presentation/map/search/MapSearchScreen.kt | 6 +++++- .../map/search/component/MapSearchTopAppBar.kt | 2 ++ .../map/search/navigation/MapSearchNavigation.kt | 7 +++++-- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/spoony/spoony/presentation/main/MainScreen.kt b/app/src/main/java/com/spoony/spoony/presentation/main/MainScreen.kt index c8d6690b..7671e135 100644 --- a/app/src/main/java/com/spoony/spoony/presentation/main/MainScreen.kt +++ b/app/src/main/java/com/spoony/spoony/presentation/main/MainScreen.kt @@ -131,7 +131,8 @@ fun MainScreen( ) mapSearchNavGraph( - paddingValues = paddingValues + paddingValues = paddingValues, + navigateUp = navigator::navigateUp ) } } diff --git a/app/src/main/java/com/spoony/spoony/presentation/map/search/MapSearchScreen.kt b/app/src/main/java/com/spoony/spoony/presentation/map/search/MapSearchScreen.kt index 0f3ab07a..3d3202e6 100644 --- a/app/src/main/java/com/spoony/spoony/presentation/map/search/MapSearchScreen.kt +++ b/app/src/main/java/com/spoony/spoony/presentation/map/search/MapSearchScreen.kt @@ -28,6 +28,7 @@ import kotlinx.collections.immutable.ImmutableList @Composable fun MapSearchRoute( + navigateUp: () -> Unit, viewModel: MapSearchViewModel = hiltViewModel() ) { val state by viewModel.state.collectAsStateWithLifecycle() @@ -40,6 +41,7 @@ fun MapSearchRoute( onSearchButtonClick = viewModel::searchLocation, onDeleteButtonClick = {}, onResultItemClick = {}, + onBackButtonClick = navigateUp, onDeleteAllButtonClick = viewModel::initRecentSearch ) } @@ -50,6 +52,7 @@ private fun MapSearchScreen( recentSearchList: ImmutableList, locationModelList: UiState>, onSearchKeywordChanged: (String) -> Unit, + onBackButtonClick: () -> Unit, onSearchButtonClick: () -> Unit, onDeleteButtonClick: () -> Unit, onResultItemClick: (Int) -> Unit, @@ -59,7 +62,8 @@ private fun MapSearchScreen( MapSearchTopAppBar( value = searchKeyword, onValueChanged = onSearchKeywordChanged, - onSearchAction = onSearchButtonClick + onSearchAction = onSearchButtonClick, + onBackButtonClick = onBackButtonClick ) when { diff --git a/app/src/main/java/com/spoony/spoony/presentation/map/search/component/MapSearchTopAppBar.kt b/app/src/main/java/com/spoony/spoony/presentation/map/search/component/MapSearchTopAppBar.kt index 4e0a92fe..fe22e7fe 100644 --- a/app/src/main/java/com/spoony/spoony/presentation/map/search/component/MapSearchTopAppBar.kt +++ b/app/src/main/java/com/spoony/spoony/presentation/map/search/component/MapSearchTopAppBar.kt @@ -13,11 +13,13 @@ import com.spoony.spoony.core.designsystem.theme.SpoonyAndroidTheme fun MapSearchTopAppBar( value: String, onValueChanged: (String) -> Unit, + onBackButtonClick: () -> Unit, modifier: Modifier = Modifier, onSearchAction: () -> Unit ) { SpoonyBasicTopAppBar( showBackButton = true, + onBackButtonClick = onBackButtonClick, modifier = modifier .background(SpoonyAndroidTheme.colors.white) ) { diff --git a/app/src/main/java/com/spoony/spoony/presentation/map/search/navigation/MapSearchNavigation.kt b/app/src/main/java/com/spoony/spoony/presentation/map/search/navigation/MapSearchNavigation.kt index 9b76de46..428034dc 100644 --- a/app/src/main/java/com/spoony/spoony/presentation/map/search/navigation/MapSearchNavigation.kt +++ b/app/src/main/java/com/spoony/spoony/presentation/map/search/navigation/MapSearchNavigation.kt @@ -16,10 +16,13 @@ fun NavController.navigateToMapSearch( } fun NavGraphBuilder.mapSearchNavGraph( - paddingValues: PaddingValues + paddingValues: PaddingValues, + navigateUp: () -> Unit ) { composable { - MapSearchRoute() + MapSearchRoute( + navigateUp = navigateUp + ) } }