From 11c6b71c38936ef1b482ce5a4e5f07d8a0fa2032 Mon Sep 17 00:00:00 2001 From: sgsk88 Date: Tue, 5 Sep 2023 21:40:36 +0900 Subject: [PATCH 01/21] =?UTF-8?q?[feature/more=5Flist]=20=EC=83=81?= =?UTF-8?q?=EC=84=B8=20=EB=A6=AC=EC=8A=A4=ED=8A=B8=20=ED=99=94=EB=A9=B4=20?= =?UTF-8?q?=ED=83=80=EC=9D=B4=ED=8B=80=20=EC=A0=84=EC=B2=B4=20=ED=8B=80=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84=20(#51)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui/detail/DetailListScreen.kt | 41 +++++++++++++++++++ .../presentation/ui/save/SaveScreen.kt | 3 +- 2 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 presentation/src/main/java/com/everymeal/presentation/ui/detail/DetailListScreen.kt diff --git a/presentation/src/main/java/com/everymeal/presentation/ui/detail/DetailListScreen.kt b/presentation/src/main/java/com/everymeal/presentation/ui/detail/DetailListScreen.kt new file mode 100644 index 00000000..cadbee19 --- /dev/null +++ b/presentation/src/main/java/com/everymeal/presentation/ui/detail/DetailListScreen.kt @@ -0,0 +1,41 @@ +package com.everymeal.presentation.ui.detail + +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.padding +import androidx.compose.material3.Scaffold +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.tooling.preview.Preview +import com.everymeal.presentation.ui.save.SaveTopBar + +@Composable +fun DetailListScreen( + title: String, +) { + Column( + modifier = Modifier + .fillMaxSize() + .background(color = Color.White), + ) { + Scaffold( + topBar = { + SaveTopBar(title = title) { + + } + } + ) { innerPadding -> + Spacer(modifier = Modifier.padding(innerPadding)) + + } + } +} + +@Preview +@Composable +fun PreviewDetailListScreen() { + DetailListScreen("맛집") +} \ No newline at end of file diff --git a/presentation/src/main/java/com/everymeal/presentation/ui/save/SaveScreen.kt b/presentation/src/main/java/com/everymeal/presentation/ui/save/SaveScreen.kt index 9d05a76b..a437326c 100644 --- a/presentation/src/main/java/com/everymeal/presentation/ui/save/SaveScreen.kt +++ b/presentation/src/main/java/com/everymeal/presentation/ui/save/SaveScreen.kt @@ -57,12 +57,13 @@ fun SaveScreen( @OptIn(ExperimentalMaterial3Api::class) @Composable fun SaveTopBar( + title: String = stringResource(id = R.string.save_title), onBackClick: () -> Unit = {} ) { TopAppBar( title = { Text( - text = stringResource(id = R.string.save_title), + text = title, style = TextStyle( fontSize = 16.sp, fontWeight = FontWeight.Bold From 2b34219af85093cc7108029ca3b3f3a895e121b1 Mon Sep 17 00:00:00 2001 From: sgsk88 Date: Tue, 5 Sep 2023 22:04:21 +0900 Subject: [PATCH 02/21] =?UTF-8?q?[feature/more=5Flist]=20=EC=B9=B4?= =?UTF-8?q?=ED=85=8C=EA=B3=A0=EB=A6=AC=20Chip=20=EA=B5=AC=ED=98=84=20(#51)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui/detail/DetailListScreen.kt | 73 ++++++++++++++++++- .../main/res/drawable/icon_arrow_bottom.xml | 10 +++ 2 files changed, 81 insertions(+), 2 deletions(-) create mode 100644 presentation/src/main/res/drawable/icon_arrow_bottom.xml diff --git a/presentation/src/main/java/com/everymeal/presentation/ui/detail/DetailListScreen.kt b/presentation/src/main/java/com/everymeal/presentation/ui/detail/DetailListScreen.kt index cadbee19..19a3d011 100644 --- a/presentation/src/main/java/com/everymeal/presentation/ui/detail/DetailListScreen.kt +++ b/presentation/src/main/java/com/everymeal/presentation/ui/detail/DetailListScreen.kt @@ -1,16 +1,30 @@ package com.everymeal.presentation.ui.detail +import androidx.compose.foundation.Image import androidx.compose.foundation.background +import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.size +import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material3.Scaffold +import androidx.compose.material3.Surface +import androidx.compose.material3.Text import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color +import androidx.compose.ui.graphics.vector.ImageVector +import androidx.compose.ui.res.vectorResource import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.dp +import com.everymeal.presentation.R import com.everymeal.presentation.ui.save.SaveTopBar +import com.everymeal.presentation.ui.theme.Grey2 +import com.everymeal.presentation.ui.theme.Grey7 +import com.everymeal.presentation.ui.theme.Typography @Composable fun DetailListScreen( @@ -28,8 +42,51 @@ fun DetailListScreen( } } ) { innerPadding -> - Spacer(modifier = Modifier.padding(innerPadding)) + Column( + modifier = Modifier + .padding(innerPadding) + .padding(horizontal = 20.dp), + ) { + DetailScreenChip( + title = "최신순", + isCategory = true, + onChipClicked = { + } + ) + } + } + } +} + +@Composable +fun DetailScreenChip( + title: String, + isCategory: Boolean, + onChipClicked: () -> Unit, +) { + Surface( + color = Grey2, + shape = RoundedCornerShape(100.dp), + ) { + Row( + verticalAlignment = Alignment.CenterVertically + ) { + Text( + text = title, + color = Grey7, + style = Typography.bodySmall, + modifier = Modifier + .padding(start = 12.dp, end = 4.dp, top = 6.dp, bottom = 6.dp) + .clickable { onChipClicked() } + ) + Image( + modifier = Modifier + .padding(end = 12.dp) + .size(12.dp), + imageVector = ImageVector.vectorResource(id = R.drawable.icon_arrow_bottom), + contentDescription = "arrow_bottom" + ) } } } @@ -38,4 +95,16 @@ fun DetailListScreen( @Composable fun PreviewDetailListScreen() { DetailListScreen("맛집") +} + +@Preview +@Composable +fun PreviewDetailScreenChip() { + DetailScreenChip( + title = "최신순", + isCategory = true, + onChipClicked = { + + } + ) } \ No newline at end of file diff --git a/presentation/src/main/res/drawable/icon_arrow_bottom.xml b/presentation/src/main/res/drawable/icon_arrow_bottom.xml new file mode 100644 index 00000000..97f6f258 --- /dev/null +++ b/presentation/src/main/res/drawable/icon_arrow_bottom.xml @@ -0,0 +1,10 @@ + + + From 44d00220dea06a01ea360d977db49218d4197d54 Mon Sep 17 00:00:00 2001 From: sgsk88 Date: Tue, 5 Sep 2023 22:15:52 +0900 Subject: [PATCH 03/21] =?UTF-8?q?[feature/more=5Flist]=20=EC=B9=B4?= =?UTF-8?q?=ED=85=8C=EA=B3=A0=EB=A6=AC=20Spacer,=20Chip=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84=20(#51)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui/detail/DetailListScreen.kt | 23 ++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/presentation/src/main/java/com/everymeal/presentation/ui/detail/DetailListScreen.kt b/presentation/src/main/java/com/everymeal/presentation/ui/detail/DetailListScreen.kt index 19a3d011..533eaaa0 100644 --- a/presentation/src/main/java/com/everymeal/presentation/ui/detail/DetailListScreen.kt +++ b/presentation/src/main/java/com/everymeal/presentation/ui/detail/DetailListScreen.kt @@ -5,6 +5,7 @@ import androidx.compose.foundation.background import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size @@ -47,13 +48,23 @@ fun DetailListScreen( .padding(innerPadding) .padding(horizontal = 20.dp), ) { - DetailScreenChip( - title = "최신순", - isCategory = true, - onChipClicked = { + Row { + DetailScreenChip( + title = "최신순", + isCategory = true, + onChipClicked = { - } - ) + } + ) + Spacer(modifier = Modifier.padding(4.dp)) + DetailScreenChip( + title = "필터", + isCategory = true, + onChipClicked = { + + } + ) + } } } } From e9a8dbe2d6996906c9de516dae1ec54da0843bec Mon Sep 17 00:00:00 2001 From: sgsk88 Date: Tue, 5 Sep 2023 22:57:38 +0900 Subject: [PATCH 04/21] =?UTF-8?q?[feature/more=5Flist]=20HomeScreen=20Navi?= =?UTF-8?q?gation=20=EC=8A=A4=ED=81=AC=EB=A6=B0=20=EC=B6=94=EA=B0=80=20(#5?= =?UTF-8?q?1)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../presentation/ui/bottom/BottomNavigation.kt | 1 + .../presentation/ui/detail/DetailListScreen.kt | 7 +++++-- .../presentation/ui/home/HomeContract.kt | 12 ++++++++++-- .../presentation/ui/home/HomeScreen.kt | 3 +++ .../presentation/ui/home/HomeViewModel.kt | 6 +++++- .../presentation/ui/main/MainScreen.kt | 17 ++++++++++++----- 6 files changed, 36 insertions(+), 10 deletions(-) diff --git a/presentation/src/main/java/com/everymeal/presentation/ui/bottom/BottomNavigation.kt b/presentation/src/main/java/com/everymeal/presentation/ui/bottom/BottomNavigation.kt index 446260ae..5085aac9 100644 --- a/presentation/src/main/java/com/everymeal/presentation/ui/bottom/BottomNavigation.kt +++ b/presentation/src/main/java/com/everymeal/presentation/ui/bottom/BottomNavigation.kt @@ -36,4 +36,5 @@ enum class EveryMealRoute(val route: String) { UNIV_FOOD("univ-food"), WHAT_FOOD("what-food"), MY_PAGE("my-page"), + DETAIL_LIST("detail-list"), } \ No newline at end of file diff --git a/presentation/src/main/java/com/everymeal/presentation/ui/detail/DetailListScreen.kt b/presentation/src/main/java/com/everymeal/presentation/ui/detail/DetailListScreen.kt index 533eaaa0..f786f3f4 100644 --- a/presentation/src/main/java/com/everymeal/presentation/ui/detail/DetailListScreen.kt +++ b/presentation/src/main/java/com/everymeal/presentation/ui/detail/DetailListScreen.kt @@ -30,6 +30,7 @@ import com.everymeal.presentation.ui.theme.Typography @Composable fun DetailListScreen( title: String, + navigateToPreviousScreen: () -> Unit, ) { Column( modifier = Modifier @@ -39,7 +40,7 @@ fun DetailListScreen( Scaffold( topBar = { SaveTopBar(title = title) { - + navigateToPreviousScreen() } } ) { innerPadding -> @@ -105,7 +106,9 @@ fun DetailScreenChip( @Preview @Composable fun PreviewDetailListScreen() { - DetailListScreen("맛집") + DetailListScreen("맛집") { + + } } @Preview diff --git a/presentation/src/main/java/com/everymeal/presentation/ui/home/HomeContract.kt b/presentation/src/main/java/com/everymeal/presentation/ui/home/HomeContract.kt index cbf84989..2c7da41b 100644 --- a/presentation/src/main/java/com/everymeal/presentation/ui/home/HomeContract.kt +++ b/presentation/src/main/java/com/everymeal/presentation/ui/home/HomeContract.kt @@ -8,13 +8,21 @@ import com.everymeal.presentation.base.ViewState class HomeContract { data class HomeState( val uiState: LoadState = LoadState.SUCCESS, + val detailListScreenType: DetailListScreenType = DetailListScreenType.RECOMMEND ) : ViewState sealed class HomeEvent : ViewEvent { - + data class OnClickDetailList(val detailListScreenType: DetailListScreenType) : HomeEvent() } sealed class HomeEffect : ViewSideEffect { - + data class NavigateToDetailListScreen(val detailListScreenType: DetailListScreenType) : HomeEffect() } +} + +enum class DetailListScreenType { + RECOMMEND, + RESTAURANT, + CAFE, + DRINK } \ No newline at end of file diff --git a/presentation/src/main/java/com/everymeal/presentation/ui/home/HomeScreen.kt b/presentation/src/main/java/com/everymeal/presentation/ui/home/HomeScreen.kt index 9b4c3bbc..a2f2ac3b 100644 --- a/presentation/src/main/java/com/everymeal/presentation/ui/home/HomeScreen.kt +++ b/presentation/src/main/java/com/everymeal/presentation/ui/home/HomeScreen.kt @@ -23,6 +23,8 @@ import androidx.compose.material3.Text import androidx.compose.material3.TopAppBar import androidx.compose.material3.TopAppBarDefaults import androidx.compose.runtime.Composable +import androidx.compose.runtime.collectAsState +import androidx.compose.runtime.getValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color @@ -33,6 +35,7 @@ import androidx.compose.ui.text.font.FontWeight.Companion.Bold import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp +import androidx.hilt.navigation.compose.hiltViewModel import com.everymeal.presentation.R import com.everymeal.presentation.components.EveryMealLineButton import com.everymeal.presentation.components.EveryMealRestaurantItem diff --git a/presentation/src/main/java/com/everymeal/presentation/ui/home/HomeViewModel.kt b/presentation/src/main/java/com/everymeal/presentation/ui/home/HomeViewModel.kt index 6027938d..a6ede7af 100644 --- a/presentation/src/main/java/com/everymeal/presentation/ui/home/HomeViewModel.kt +++ b/presentation/src/main/java/com/everymeal/presentation/ui/home/HomeViewModel.kt @@ -35,6 +35,10 @@ class HomeViewModel @Inject constructor( ) { override fun handleEvents(event: HomeEvent) { - + when (event) { + is HomeEvent.OnClickDetailList -> { + sendEffect({ HomeEffect.NavigateToDetailListScreen(event.detailListScreenType) }) + } + } } } \ No newline at end of file diff --git a/presentation/src/main/java/com/everymeal/presentation/ui/main/MainScreen.kt b/presentation/src/main/java/com/everymeal/presentation/ui/main/MainScreen.kt index 234b0324..96017b65 100644 --- a/presentation/src/main/java/com/everymeal/presentation/ui/main/MainScreen.kt +++ b/presentation/src/main/java/com/everymeal/presentation/ui/main/MainScreen.kt @@ -13,7 +13,9 @@ import androidx.navigation.compose.currentBackStackEntryAsState import androidx.navigation.compose.rememberNavController import com.everymeal.presentation.ui.bottom.BottomNavigation import com.everymeal.presentation.ui.bottom.EveryMealBottomNavigation +import com.everymeal.presentation.ui.bottom.EveryMealRoute import com.everymeal.presentation.ui.bottom.navigateBottomNavigationScreen +import com.everymeal.presentation.ui.detail.DetailListScreen import com.everymeal.presentation.ui.home.HomeScreen import com.everymeal.presentation.ui.mypage.MyPageScreen import com.everymeal.presentation.ui.univfood.UnivFoodScreen @@ -42,20 +44,25 @@ fun MainScreen( NavHost( modifier = Modifier.padding(padding), navController = navController, - startDestination = BottomNavigation.HOME.route, + startDestination = EveryMealRoute.HOME.route, ) { - composable(route = BottomNavigation.HOME.route) { + composable(route = EveryMealRoute.HOME.route) { HomeScreen() } - composable(route = BottomNavigation.UNIV_FOOD.route) { + composable(route = EveryMealRoute.UNIV_FOOD.route) { UnivFoodScreen() } - composable(route = BottomNavigation.WHAT_FOOD.route) { + composable(route = EveryMealRoute.WHAT_FOOD.route) { WhatFoodScreen() } - composable(route = BottomNavigation.MY_PAGE.route) { + composable(route = EveryMealRoute.MY_PAGE.route) { MyPageScreen() } + composable(route = EveryMealRoute.DETAIL_LIST.route) { + DetailListScreen(title = "맛집") { + navController.popBackStack() + } + } } } } From 4ae4759e87f68e6cb74807680966f14a1fb8790d Mon Sep 17 00:00:00 2001 From: sgsk88 Date: Tue, 5 Sep 2023 23:08:20 +0900 Subject: [PATCH 05/21] =?UTF-8?q?[feature/more=5Flist]=20develop=20?= =?UTF-8?q?=EC=B6=A9=EB=8F=8C=20=ED=95=B4=EA=B2=B0=20(#51)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../presentation/ui/home/HomeContract.kt | 2 +- .../presentation/ui/home/HomeScreen.kt | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/presentation/src/main/java/com/everymeal/presentation/ui/home/HomeContract.kt b/presentation/src/main/java/com/everymeal/presentation/ui/home/HomeContract.kt index e89a5148..9f6544b6 100644 --- a/presentation/src/main/java/com/everymeal/presentation/ui/home/HomeContract.kt +++ b/presentation/src/main/java/com/everymeal/presentation/ui/home/HomeContract.kt @@ -8,7 +8,7 @@ import com.everymeal.presentation.base.ViewState class HomeContract { data class HomeState( val uiState: LoadState = LoadState.SUCCESS, - val detailListScreenType: DetailListScreenType = DetailListScreenType.RECOMMEND + val detailListScreenType: DetailListScreenType = DetailListScreenType.RECOMMEND, val bottomSheetState: Boolean = false ) : ViewState diff --git a/presentation/src/main/java/com/everymeal/presentation/ui/home/HomeScreen.kt b/presentation/src/main/java/com/everymeal/presentation/ui/home/HomeScreen.kt index 6815f330..4f286eec 100644 --- a/presentation/src/main/java/com/everymeal/presentation/ui/home/HomeScreen.kt +++ b/presentation/src/main/java/com/everymeal/presentation/ui/home/HomeScreen.kt @@ -24,6 +24,9 @@ import androidx.compose.material3.Text import androidx.compose.material3.TopAppBar import androidx.compose.material3.TopAppBarDefaults import androidx.compose.runtime.Composable +import androidx.compose.runtime.collectAsState +import androidx.compose.runtime.getValue +import androidx.compose.runtime.remember import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color @@ -132,7 +135,9 @@ fun HomeScreen( .fillMaxWidth(), ) { item { - HomeMainTopLayout() + HomeMainTopLayout { + homeViewModel.setEvent(HomeContract.HomeEvent.BottomSheetStateChange(true)) + } HomeCategoryList() Spacer(modifier = Modifier.padding(10.dp)) @@ -241,12 +246,20 @@ fun HomeTopAppBar() { } @Composable -fun HomeMainTopLayout() { +fun HomeMainTopLayout( + onClick: () -> Unit, +) { Row( modifier = Modifier .fillMaxWidth() .padding(20.dp) .background(Gray300, RoundedCornerShape(12.dp)) + .clickable( + indication = null, + interactionSource = remember { MutableInteractionSource() } + ) { + onClick() + } .padding(horizontal = Paddings.extra, vertical = 14.dp), verticalAlignment = Alignment.CenterVertically, ) { From 90394db04cd050e00c174db3f5e56a57ab2a6eb3 Mon Sep 17 00:00:00 2001 From: sgsk88 Date: Tue, 5 Sep 2023 23:49:38 +0900 Subject: [PATCH 06/21] =?UTF-8?q?[feature/more=5Flist]=20=EC=83=81?= =?UTF-8?q?=EC=84=B8=20=EB=A6=AC=EC=8A=A4=ED=8A=B8=20=ED=99=94=EB=A9=B4=20?= =?UTF-8?q?=EC=9D=B4=EB=8F=99=20(#51)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/EveryMealRestaurantItem.kt | 4 +++- .../presentation/ui/home/HomeContract.kt | 4 +--- .../presentation/ui/home/HomeScreen.kt | 21 ++++++++++++------- .../presentation/ui/main/MainScreen.kt | 4 +++- 4 files changed, 21 insertions(+), 12 deletions(-) diff --git a/presentation/src/main/java/com/everymeal/presentation/components/EveryMealRestaurantItem.kt b/presentation/src/main/java/com/everymeal/presentation/components/EveryMealRestaurantItem.kt index 79fd7394..b56bddf3 100644 --- a/presentation/src/main/java/com/everymeal/presentation/components/EveryMealRestaurantItem.kt +++ b/presentation/src/main/java/com/everymeal/presentation/components/EveryMealRestaurantItem.kt @@ -254,6 +254,8 @@ fun RestaurantImage(restaurant: Restaurant) { @Composable fun HomeScreenPreview() { EveryMeal_AndroidTheme { - HomeScreen() + HomeScreen() { + + } } } \ No newline at end of file diff --git a/presentation/src/main/java/com/everymeal/presentation/ui/home/HomeContract.kt b/presentation/src/main/java/com/everymeal/presentation/ui/home/HomeContract.kt index 9f6544b6..dfe77963 100644 --- a/presentation/src/main/java/com/everymeal/presentation/ui/home/HomeContract.kt +++ b/presentation/src/main/java/com/everymeal/presentation/ui/home/HomeContract.kt @@ -14,9 +14,7 @@ class HomeContract { sealed class HomeEvent : ViewEvent { data class OnClickDetailList(val detailListScreenType: DetailListScreenType) : HomeEvent() - data class BottomSheetStateChange( - val bottomSheetState: Boolean - ) : HomeEvent() + data class BottomSheetStateChange(val bottomSheetState: Boolean) : HomeEvent() } sealed class HomeEffect : ViewSideEffect { diff --git a/presentation/src/main/java/com/everymeal/presentation/ui/home/HomeScreen.kt b/presentation/src/main/java/com/everymeal/presentation/ui/home/HomeScreen.kt index 4f286eec..a5f21fab 100644 --- a/presentation/src/main/java/com/everymeal/presentation/ui/home/HomeScreen.kt +++ b/presentation/src/main/java/com/everymeal/presentation/ui/home/HomeScreen.kt @@ -53,6 +53,7 @@ import com.everymeal.presentation.ui.theme.Paddings @Composable fun HomeScreen( homeViewModel : HomeViewModel = hiltViewModel(), + onDetailScreenClickType : (String) -> Unit, ) { val items = listOf( Restaurant( @@ -138,7 +139,9 @@ fun HomeScreen( HomeMainTopLayout { homeViewModel.setEvent(HomeContract.HomeEvent.BottomSheetStateChange(true)) } - HomeCategoryList() + HomeCategoryList { + onDetailScreenClickType(it) + } Spacer(modifier = Modifier.padding(10.dp)) HomeDivider() @@ -291,7 +294,9 @@ fun HomeMainTopLayout( } @Composable -fun HomeCategoryList() { +fun HomeCategoryList( + onClick: (String) -> Unit +) { Row( modifier = Modifier .fillMaxWidth() @@ -302,25 +307,25 @@ fun HomeCategoryList() { R.drawable.ic_homemenu_recommend, R.string.home_top_category_recommend ) { - + onClick(R.string.home_top_category_recommend.toString()) } CategoryItem( R.drawable.ic_homemenu_bap, R.string.home_top_category_rice ) { - + onClick(R.string.home_top_category_rice.toString()) } CategoryItem( R.drawable.ic_homemenu_cake, R.string.home_top_category_cafe ) { - + onClick(R.string.home_top_category_cafe.toString()) } CategoryItem( R.drawable.ic_homemenu_beer, R.string.home_top_category_drink ) { - + onClick(R.string.home_top_category_drink.toString()) } } } @@ -379,6 +384,8 @@ fun CategoryItem( @Composable fun HomeScreenPreview() { EveryMeal_AndroidTheme { - HomeScreen() + HomeScreen() { + + } } } \ No newline at end of file diff --git a/presentation/src/main/java/com/everymeal/presentation/ui/main/MainScreen.kt b/presentation/src/main/java/com/everymeal/presentation/ui/main/MainScreen.kt index 96017b65..99991fba 100644 --- a/presentation/src/main/java/com/everymeal/presentation/ui/main/MainScreen.kt +++ b/presentation/src/main/java/com/everymeal/presentation/ui/main/MainScreen.kt @@ -47,7 +47,9 @@ fun MainScreen( startDestination = EveryMealRoute.HOME.route, ) { composable(route = EveryMealRoute.HOME.route) { - HomeScreen() + HomeScreen { + navController.navigate(EveryMealRoute.DETAIL_LIST.route) + } } composable(route = EveryMealRoute.UNIV_FOOD.route) { UnivFoodScreen() From fd06ab64fa5f783077653fc650efa4d1aeac98ad Mon Sep 17 00:00:00 2001 From: sgsk88 Date: Tue, 5 Sep 2023 23:56:51 +0900 Subject: [PATCH 07/21] =?UTF-8?q?[feature/more=5Flist]=20=EC=83=81?= =?UTF-8?q?=EC=84=B8=20=EB=A6=AC=EC=8A=A4=ED=8A=B8=20=ED=99=94=EB=A9=B4=20?= =?UTF-8?q?=EB=B0=94=ED=85=80=EB=84=A4=EB=B9=84=EA=B2=8C=EC=9D=B4=EC=85=98?= =?UTF-8?q?=20=EC=A0=9C=EA=B1=B0=20(#51)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../presentation/ui/main/MainScreen.kt | 32 +++++++++++++------ 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/presentation/src/main/java/com/everymeal/presentation/ui/main/MainScreen.kt b/presentation/src/main/java/com/everymeal/presentation/ui/main/MainScreen.kt index 99991fba..2a35d663 100644 --- a/presentation/src/main/java/com/everymeal/presentation/ui/main/MainScreen.kt +++ b/presentation/src/main/java/com/everymeal/presentation/ui/main/MainScreen.kt @@ -4,6 +4,9 @@ import androidx.compose.foundation.layout.padding import androidx.compose.material3.Scaffold import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.saveable.rememberSaveable +import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier import androidx.compose.ui.tooling.preview.Preview import androidx.navigation.NavHostController @@ -27,18 +30,21 @@ fun MainScreen( ) { val navBackStackEntry by navController.currentBackStackEntryAsState() val currentDestination = navBackStackEntry?.destination + var bottomBarState by rememberSaveable { mutableStateOf(true) } Scaffold( bottomBar = { - EveryMealBottomNavigation( - currentDestination = currentDestination, - navigateToScreen = { navigationItem -> - navigateBottomNavigationScreen( - navController = navController, - navigationItem = navigationItem, - ) - } - ) + if (bottomBarState) { + EveryMealBottomNavigation( + currentDestination = currentDestination, + navigateToScreen = { navigationItem -> + navigateBottomNavigationScreen( + navController = navController, + navigationItem = navigationItem, + ) + } + ) + } } ) { padding -> NavHost( @@ -67,6 +73,14 @@ fun MainScreen( } } } + + bottomBarState = when (currentDestination?.route) { + EveryMealRoute.HOME.route -> true + EveryMealRoute.UNIV_FOOD.route -> true + EveryMealRoute.WHAT_FOOD.route -> true + EveryMealRoute.MY_PAGE.route -> true + else -> false + } } @Preview From c3f6dcdf4cd0745f8e2eea78f6f3cbc9285b2812 Mon Sep 17 00:00:00 2001 From: sgsk88 Date: Wed, 6 Sep 2023 00:17:52 +0900 Subject: [PATCH 08/21] =?UTF-8?q?[feature/more=5Flist]=20=EC=83=81?= =?UTF-8?q?=EC=84=B8=ED=99=94=EB=A9=B4=20argument=20=EC=B6=94=EA=B0=80=20(?= =?UTF-8?q?#51)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../presentation/ui/home/HomeContract.kt | 19 ++++++++++++++++++ .../presentation/ui/home/HomeScreen.kt | 20 +++++++++++++++---- .../presentation/ui/main/MainScreen.kt | 4 ++-- 3 files changed, 37 insertions(+), 6 deletions(-) diff --git a/presentation/src/main/java/com/everymeal/presentation/ui/home/HomeContract.kt b/presentation/src/main/java/com/everymeal/presentation/ui/home/HomeContract.kt index dfe77963..dadf9ac0 100644 --- a/presentation/src/main/java/com/everymeal/presentation/ui/home/HomeContract.kt +++ b/presentation/src/main/java/com/everymeal/presentation/ui/home/HomeContract.kt @@ -27,4 +27,23 @@ enum class DetailListScreenType { RESTAURANT, CAFE, DRINK +} + +fun String.DetailListScreenType(): DetailListScreenType { + return when (this) { + "추천" -> DetailListScreenType.RECOMMEND + "밥집" -> DetailListScreenType.RESTAURANT + "카페" -> DetailListScreenType.CAFE + "술집" -> DetailListScreenType.DRINK + else -> DetailListScreenType.RECOMMEND + } +} + +fun DetailListScreenType.title(): String { + return when (this) { + DetailListScreenType.RECOMMEND -> "추천" + DetailListScreenType.RESTAURANT -> "밥집" + DetailListScreenType.CAFE -> "카페" + DetailListScreenType.DRINK -> "술집" + } } \ No newline at end of file diff --git a/presentation/src/main/java/com/everymeal/presentation/ui/home/HomeScreen.kt b/presentation/src/main/java/com/everymeal/presentation/ui/home/HomeScreen.kt index a5f21fab..1ab13a05 100644 --- a/presentation/src/main/java/com/everymeal/presentation/ui/home/HomeScreen.kt +++ b/presentation/src/main/java/com/everymeal/presentation/ui/home/HomeScreen.kt @@ -24,6 +24,7 @@ import androidx.compose.material3.Text import androidx.compose.material3.TopAppBar import androidx.compose.material3.TopAppBarDefaults import androidx.compose.runtime.Composable +import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue import androidx.compose.runtime.remember @@ -141,6 +142,7 @@ fun HomeScreen( } HomeCategoryList { onDetailScreenClickType(it) + homeViewModel.setEvent(HomeContract.HomeEvent.OnClickDetailList(it.DetailListScreenType())) } Spacer(modifier = Modifier.padding(10.dp)) @@ -207,6 +209,16 @@ fun HomeScreen( } } } + + LaunchedEffect(key1 = homeViewModel.effect) { + homeViewModel.effect.collect { effect -> + when (effect) { + is HomeContract.HomeEffect.NavigateToDetailListScreen -> { + onDetailScreenClickType(effect.detailListScreenType.title()) + } + } + } + } } @OptIn(ExperimentalMaterial3Api::class) @@ -307,25 +319,25 @@ fun HomeCategoryList( R.drawable.ic_homemenu_recommend, R.string.home_top_category_recommend ) { - onClick(R.string.home_top_category_recommend.toString()) + onClick("추천") } CategoryItem( R.drawable.ic_homemenu_bap, R.string.home_top_category_rice ) { - onClick(R.string.home_top_category_rice.toString()) + onClick("밥집") } CategoryItem( R.drawable.ic_homemenu_cake, R.string.home_top_category_cafe ) { - onClick(R.string.home_top_category_cafe.toString()) + onClick("카페") } CategoryItem( R.drawable.ic_homemenu_beer, R.string.home_top_category_drink ) { - onClick(R.string.home_top_category_drink.toString()) + onClick("술집") } } } diff --git a/presentation/src/main/java/com/everymeal/presentation/ui/main/MainScreen.kt b/presentation/src/main/java/com/everymeal/presentation/ui/main/MainScreen.kt index 2a35d663..00ebd794 100644 --- a/presentation/src/main/java/com/everymeal/presentation/ui/main/MainScreen.kt +++ b/presentation/src/main/java/com/everymeal/presentation/ui/main/MainScreen.kt @@ -53,8 +53,8 @@ fun MainScreen( startDestination = EveryMealRoute.HOME.route, ) { composable(route = EveryMealRoute.HOME.route) { - HomeScreen { - navController.navigate(EveryMealRoute.DETAIL_LIST.route) + HomeScreen { detailScreenType -> + navController.navigate(EveryMealRoute.DETAIL_LIST.route.plus("/$detailScreenType")) } } composable(route = EveryMealRoute.UNIV_FOOD.route) { From eb3b0d73217547bcec8721048ab1469ebadb2404 Mon Sep 17 00:00:00 2001 From: sgsk88 Date: Wed, 6 Sep 2023 00:50:26 +0900 Subject: [PATCH 09/21] =?UTF-8?q?[feature/more=5Flist]=20argument=20?= =?UTF-8?q?=EC=A0=84=EB=8B=AC=20=EC=83=81=EC=84=B8=ED=99=94=EB=A9=B4?= =?UTF-8?q?=EC=9C=BC=EB=A1=9C=20(#51)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../presentation/ui/main/MainScreen.kt | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/presentation/src/main/java/com/everymeal/presentation/ui/main/MainScreen.kt b/presentation/src/main/java/com/everymeal/presentation/ui/main/MainScreen.kt index 00ebd794..88f314ea 100644 --- a/presentation/src/main/java/com/everymeal/presentation/ui/main/MainScreen.kt +++ b/presentation/src/main/java/com/everymeal/presentation/ui/main/MainScreen.kt @@ -10,10 +10,12 @@ import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier import androidx.compose.ui.tooling.preview.Preview import androidx.navigation.NavHostController +import androidx.navigation.NavType import androidx.navigation.compose.NavHost import androidx.navigation.compose.composable import androidx.navigation.compose.currentBackStackEntryAsState import androidx.navigation.compose.rememberNavController +import androidx.navigation.navArgument import com.everymeal.presentation.ui.bottom.BottomNavigation import com.everymeal.presentation.ui.bottom.EveryMealBottomNavigation import com.everymeal.presentation.ui.bottom.EveryMealRoute @@ -24,6 +26,7 @@ import com.everymeal.presentation.ui.mypage.MyPageScreen import com.everymeal.presentation.ui.univfood.UnivFoodScreen import com.everymeal.presentation.ui.whatfood.WhatFoodScreen +const val DETAIL_SCREEN_TYPE = "detailScreenType" @Composable fun MainScreen( navController: NavHostController = rememberNavController(), @@ -53,9 +56,11 @@ fun MainScreen( startDestination = EveryMealRoute.HOME.route, ) { composable(route = EveryMealRoute.HOME.route) { - HomeScreen { detailScreenType -> - navController.navigate(EveryMealRoute.DETAIL_LIST.route.plus("/$detailScreenType")) - } + HomeScreen( + onDetailScreenClickType = { detailScreenType -> + navController.navigate(EveryMealRoute.DETAIL_LIST.route.plus("/$detailScreenType")) + } + ) } composable(route = EveryMealRoute.UNIV_FOOD.route) { UnivFoodScreen() @@ -66,10 +71,12 @@ fun MainScreen( composable(route = EveryMealRoute.MY_PAGE.route) { MyPageScreen() } - composable(route = EveryMealRoute.DETAIL_LIST.route) { - DetailListScreen(title = "맛집") { - navController.popBackStack() - } + composable(route = EveryMealRoute.DETAIL_LIST.route.plus("/{$DETAIL_SCREEN_TYPE}"),) { + val detailScreenType = it.arguments?.getString(DETAIL_SCREEN_TYPE) ?: "" + DetailListScreen( + title = detailScreenType, + navigateToPreviousScreen = { navController.popBackStack() } + ) } } } From caaa94df865830ae9371cdf8eb5f649a8e34f2a7 Mon Sep 17 00:00:00 2001 From: sgsk88 Date: Thu, 7 Sep 2023 21:20:48 +0900 Subject: [PATCH 10/21] =?UTF-8?q?[feature/more=5Flist]=20x=20Image=20?= =?UTF-8?q?=EB=B6=84=EA=B8=B0=EC=B2=98=EB=A6=AC=20=EC=B6=94=EA=B0=80=20?= =?UTF-8?q?=EB=B0=8F=20Click=20indication=20=EC=A0=9C=EA=B1=B0=20(#51)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui/detail/DetailListScreen.kt | 36 +++++++++++++------ .../src/main/res/drawable/icon_x_mono.xml | 10 ++++++ 2 files changed, 35 insertions(+), 11 deletions(-) create mode 100644 presentation/src/main/res/drawable/icon_x_mono.xml diff --git a/presentation/src/main/java/com/everymeal/presentation/ui/detail/DetailListScreen.kt b/presentation/src/main/java/com/everymeal/presentation/ui/detail/DetailListScreen.kt index f786f3f4..e534465c 100644 --- a/presentation/src/main/java/com/everymeal/presentation/ui/detail/DetailListScreen.kt +++ b/presentation/src/main/java/com/everymeal/presentation/ui/detail/DetailListScreen.kt @@ -3,6 +3,7 @@ package com.everymeal.presentation.ui.detail import androidx.compose.foundation.Image import androidx.compose.foundation.background import androidx.compose.foundation.clickable +import androidx.compose.foundation.interaction.MutableInteractionSource import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer @@ -14,6 +15,7 @@ import androidx.compose.material3.Scaffold import androidx.compose.material3.Surface import androidx.compose.material3.Text import androidx.compose.runtime.Composable +import androidx.compose.runtime.remember import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color @@ -60,7 +62,7 @@ fun DetailListScreen( Spacer(modifier = Modifier.padding(4.dp)) DetailScreenChip( title = "필터", - isCategory = true, + isCategory = false, onChipClicked = { } @@ -78,6 +80,10 @@ fun DetailScreenChip( onChipClicked: () -> Unit, ) { Surface( + modifier = Modifier.clickable( + indication = null, + interactionSource = remember { MutableInteractionSource() } + ) { onChipClicked() }, color = Grey2, shape = RoundedCornerShape(100.dp), ) { @@ -88,17 +94,25 @@ fun DetailScreenChip( text = title, color = Grey7, style = Typography.bodySmall, - modifier = Modifier - .padding(start = 12.dp, end = 4.dp, top = 6.dp, bottom = 6.dp) - .clickable { onChipClicked() } - ) - Image( - modifier = Modifier - .padding(end = 12.dp) - .size(12.dp), - imageVector = ImageVector.vectorResource(id = R.drawable.icon_arrow_bottom), - contentDescription = "arrow_bottom" + modifier = Modifier.padding(start = 12.dp, end = 4.dp, top = 6.dp, bottom = 6.dp) ) + if(isCategory) { + Image( + modifier = Modifier + .padding(end = 12.dp) + .size(12.dp), + imageVector = ImageVector.vectorResource(id = R.drawable.icon_arrow_bottom), + contentDescription = "arrow_bottom" + ) + } else { + Image( + modifier = Modifier + .padding(end = 12.dp) + .size(12.dp), + imageVector = ImageVector.vectorResource(id = R.drawable.icon_x_mono), + contentDescription = "close" + ) + } } } } diff --git a/presentation/src/main/res/drawable/icon_x_mono.xml b/presentation/src/main/res/drawable/icon_x_mono.xml new file mode 100644 index 00000000..4ede5043 --- /dev/null +++ b/presentation/src/main/res/drawable/icon_x_mono.xml @@ -0,0 +1,10 @@ + + + From 5875714ec32da5edbe0676f60f1ac3fc6a12dc3e Mon Sep 17 00:00:00 2001 From: sgsk88 Date: Thu, 7 Sep 2023 21:34:04 +0900 Subject: [PATCH 11/21] =?UTF-8?q?[feature/more=5Flist]=20=ED=85=8D?= =?UTF-8?q?=EC=8A=A4=ED=8A=B8=20=ED=81=B4=EB=A6=AD=EC=98=81=EC=97=AD=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80=20(#51)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/EveryMealBottomSheetDialog.kt | 43 +++++++++++++++++++ .../ui/detail/DetailListScreen.kt | 2 +- presentation/src/main/res/values/strings.xml | 5 ++- 3 files changed, 48 insertions(+), 2 deletions(-) diff --git a/presentation/src/main/java/com/everymeal/presentation/components/EveryMealBottomSheetDialog.kt b/presentation/src/main/java/com/everymeal/presentation/components/EveryMealBottomSheetDialog.kt index b82b27ed..eb60497a 100644 --- a/presentation/src/main/java/com/everymeal/presentation/components/EveryMealBottomSheetDialog.kt +++ b/presentation/src/main/java/com/everymeal/presentation/components/EveryMealBottomSheetDialog.kt @@ -65,4 +65,47 @@ fun EveryMealMainBottomSheetDialog( Spacer(modifier = Modifier.padding(10.dp)) } } +} + +@OptIn(ExperimentalMaterial3Api::class) +@Composable +fun EveryMealSortCategoryBottomSheetDialog( + onClick: () -> Unit, + onDismiss: () -> Unit +) { + ModalBottomSheet( + onDismissRequest = { onDismiss() }, + containerColor = Color.White, + ) { + Column( + modifier = Modifier + .fillMaxWidth() + .padding(horizontal = 20.dp) + ) { + Text( + modifier = Modifier + .fillMaxWidth() + .padding(vertical = 14.dp), + text = stringResource(R.string.popularity_sort), + fontSize = 17.sp, + color = Gray900, + fontWeight = FontWeight.SemiBold, + ) + Spacer(modifier = Modifier.padding(4.dp)) + Text( + text = stringResource(R.string.distance_sort), + fontSize = 17.sp, + color = Gray900, + fontWeight = FontWeight.SemiBold, + ) + Spacer(modifier = Modifier.padding(10.dp)) + Text( + text = stringResource(R.string.recent_sort), + fontSize = 17.sp, + color = Gray900, + fontWeight = FontWeight.SemiBold, + ) + Spacer(modifier = Modifier.padding(10.dp)) + } + } } \ No newline at end of file diff --git a/presentation/src/main/java/com/everymeal/presentation/ui/detail/DetailListScreen.kt b/presentation/src/main/java/com/everymeal/presentation/ui/detail/DetailListScreen.kt index e534465c..da5c5a18 100644 --- a/presentation/src/main/java/com/everymeal/presentation/ui/detail/DetailListScreen.kt +++ b/presentation/src/main/java/com/everymeal/presentation/ui/detail/DetailListScreen.kt @@ -62,7 +62,7 @@ fun DetailListScreen( Spacer(modifier = Modifier.padding(4.dp)) DetailScreenChip( title = "필터", - isCategory = false, + isCategory = true, onChipClicked = { } diff --git a/presentation/src/main/res/values/strings.xml b/presentation/src/main/res/values/strings.xml index 86f6f574..c140bfd6 100644 --- a/presentation/src/main/res/values/strings.xml +++ b/presentation/src/main/res/values/strings.xml @@ -53,7 +53,6 @@ 검색 결과가 없어요 최근 검색어 - 저장 저장한 가게가 없어요 @@ -63,4 +62,8 @@ 바이럴 마케팅 없는 신뢰적인 정보를 공유하기 위해\n학교 인증이 필요해요 인증하러 가기 + + 인기순 + 거리순 + 최신순 \ No newline at end of file From 1c586b54fb267832d56632e20d17ed32a52b20ca Mon Sep 17 00:00:00 2001 From: sgsk88 Date: Thu, 7 Sep 2023 21:38:33 +0900 Subject: [PATCH 12/21] =?UTF-8?q?[feature/more=5Flist]=20DetailContract=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1=20(#51)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/EveryMealBottomSheetDialog.kt | 6 ++-- .../ui/detail/DetailListContract.kt | 29 +++++++++++++++++++ 2 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 presentation/src/main/java/com/everymeal/presentation/ui/detail/DetailListContract.kt diff --git a/presentation/src/main/java/com/everymeal/presentation/components/EveryMealBottomSheetDialog.kt b/presentation/src/main/java/com/everymeal/presentation/components/EveryMealBottomSheetDialog.kt index eb60497a..9d7a541d 100644 --- a/presentation/src/main/java/com/everymeal/presentation/components/EveryMealBottomSheetDialog.kt +++ b/presentation/src/main/java/com/everymeal/presentation/components/EveryMealBottomSheetDialog.kt @@ -1,6 +1,7 @@ package com.everymeal.presentation.components import androidx.compose.foundation.Image +import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxWidth @@ -70,7 +71,7 @@ fun EveryMealMainBottomSheetDialog( @OptIn(ExperimentalMaterial3Api::class) @Composable fun EveryMealSortCategoryBottomSheetDialog( - onClick: () -> Unit, + onClick: (String) -> Unit, onDismiss: () -> Unit ) { ModalBottomSheet( @@ -85,7 +86,8 @@ fun EveryMealSortCategoryBottomSheetDialog( Text( modifier = Modifier .fillMaxWidth() - .padding(vertical = 14.dp), + .padding(vertical = 14.dp) + .clickable { onClick("인기순") }, text = stringResource(R.string.popularity_sort), fontSize = 17.sp, color = Gray900, diff --git a/presentation/src/main/java/com/everymeal/presentation/ui/detail/DetailListContract.kt b/presentation/src/main/java/com/everymeal/presentation/ui/detail/DetailListContract.kt new file mode 100644 index 00000000..192abf77 --- /dev/null +++ b/presentation/src/main/java/com/everymeal/presentation/ui/detail/DetailListContract.kt @@ -0,0 +1,29 @@ +package com.everymeal.presentation.ui.detail + +import com.everymeal.presentation.base.LoadState +import com.everymeal.presentation.base.ViewEvent +import com.everymeal.presentation.base.ViewSideEffect +import com.everymeal.presentation.base.ViewState + +class DetailContract { + data class DetailState( + val uiState: LoadState = LoadState.SUCCESS, + val detailSortCategoryType: DetailSortCategoryType = DetailSortCategoryType.POPULARITY, + val bottomSheetState: Boolean = false + ) : ViewState + + sealed class DetailEvent : ViewEvent { + data class OnClickDetailListCategoryType(val detailSortCategoryType: DetailSortCategoryType) : DetailEvent() + data class BottomSheetStateChange(val bottomSheetState: Boolean) : DetailEvent() + } + + sealed class HomeEffect : ViewSideEffect { + + } +} + +enum class DetailSortCategoryType { + POPULARITY, + DISTANCE, + RECENT +} \ No newline at end of file From 1f041b73f6ce8f84b0247b9c5d08da3a892f9595 Mon Sep 17 00:00:00 2001 From: sgsk88 Date: Sat, 9 Sep 2023 01:53:28 +0900 Subject: [PATCH 13/21] =?UTF-8?q?[feature/more=5Flist]=20DetailViewModel?= =?UTF-8?q?=20=EC=83=9D=EC=84=B1=20(#51)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui/detail/DetailListViewModel.kt | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 presentation/src/main/java/com/everymeal/presentation/ui/detail/DetailListViewModel.kt diff --git a/presentation/src/main/java/com/everymeal/presentation/ui/detail/DetailListViewModel.kt b/presentation/src/main/java/com/everymeal/presentation/ui/detail/DetailListViewModel.kt new file mode 100644 index 00000000..0791db1a --- /dev/null +++ b/presentation/src/main/java/com/everymeal/presentation/ui/detail/DetailListViewModel.kt @@ -0,0 +1,33 @@ +package com.everymeal.presentation.ui.detail + +import com.everymeal.presentation.base.BaseViewModel +import com.everymeal.presentation.ui.detail.DetailContract.DetailEvent +import com.everymeal.presentation.ui.detail.DetailContract.DetailState +import com.everymeal.presentation.ui.detail.DetailContract.HomeEffect +import javax.inject.Inject + +class DetailListViewModel @Inject constructor( + +): BaseViewModel( + DetailState() +) { + + override fun handleEvents(event: DetailEvent) { + when (event) { + is DetailEvent.OnClickDetailListCategoryType -> { + updateState { + copy( + detailSortCategoryType = event.detailSortCategoryType + ) + } + } + is DetailEvent.BottomSheetStateChange -> { + updateState { + copy( + bottomSheetState = event.bottomSheetState + ) + } + } + } + } +} \ No newline at end of file From 1dd7231b609d2302356c4cbbd701a1fc01fa691f Mon Sep 17 00:00:00 2001 From: sgsk88 Date: Sat, 9 Sep 2023 01:59:33 +0900 Subject: [PATCH 14/21] =?UTF-8?q?[feature/more=5Flist]=20DetailScreen=20Cl?= =?UTF-8?q?ick=20=EB=A6=AC=EC=8A=A4=EB=84=88=20=EC=B6=94=EA=B0=80=20(#51)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../presentation/components/EveryMealBottomSheetDialog.kt | 8 ++++++++ .../everymeal/presentation/ui/detail/DetailListScreen.kt | 4 +++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/presentation/src/main/java/com/everymeal/presentation/components/EveryMealBottomSheetDialog.kt b/presentation/src/main/java/com/everymeal/presentation/components/EveryMealBottomSheetDialog.kt index 9d7a541d..1b54a029 100644 --- a/presentation/src/main/java/com/everymeal/presentation/components/EveryMealBottomSheetDialog.kt +++ b/presentation/src/main/java/com/everymeal/presentation/components/EveryMealBottomSheetDialog.kt @@ -95,6 +95,10 @@ fun EveryMealSortCategoryBottomSheetDialog( ) Spacer(modifier = Modifier.padding(4.dp)) Text( + modifier = Modifier + .fillMaxWidth() + .padding(vertical = 14.dp) + .clickable { onClick("거리순") }, text = stringResource(R.string.distance_sort), fontSize = 17.sp, color = Gray900, @@ -102,6 +106,10 @@ fun EveryMealSortCategoryBottomSheetDialog( ) Spacer(modifier = Modifier.padding(10.dp)) Text( + modifier = Modifier + .fillMaxWidth() + .padding(vertical = 14.dp) + .clickable { onClick("최신순") }, text = stringResource(R.string.recent_sort), fontSize = 17.sp, color = Gray900, diff --git a/presentation/src/main/java/com/everymeal/presentation/ui/detail/DetailListScreen.kt b/presentation/src/main/java/com/everymeal/presentation/ui/detail/DetailListScreen.kt index da5c5a18..162d4bd4 100644 --- a/presentation/src/main/java/com/everymeal/presentation/ui/detail/DetailListScreen.kt +++ b/presentation/src/main/java/com/everymeal/presentation/ui/detail/DetailListScreen.kt @@ -23,6 +23,7 @@ import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.res.vectorResource import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp +import androidx.hilt.navigation.compose.hiltViewModel import com.everymeal.presentation.R import com.everymeal.presentation.ui.save.SaveTopBar import com.everymeal.presentation.ui.theme.Grey2 @@ -31,6 +32,7 @@ import com.everymeal.presentation.ui.theme.Typography @Composable fun DetailListScreen( + detailListViewModel: DetailListViewModel = hiltViewModel(), title: String, navigateToPreviousScreen: () -> Unit, ) { @@ -120,7 +122,7 @@ fun DetailScreenChip( @Preview @Composable fun PreviewDetailListScreen() { - DetailListScreen("맛집") { + DetailListScreen(title = "맛집") { } } From 9921437bb1ff812f35d27c1279eaba9a85f54035 Mon Sep 17 00:00:00 2001 From: sgsk88 Date: Sun, 10 Sep 2023 23:28:03 +0900 Subject: [PATCH 15/21] =?UTF-8?q?[feature/more=5Flist]=20DetailListScreen?= =?UTF-8?q?=20ViewModel=20=EC=97=B0=EA=B2=B0=20(#51)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/EveryMealBottomSheetDialog.kt | 14 ++++++------- .../ui/detail/DetailListScreen.kt | 21 ++++++++++++++++++- 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a/presentation/src/main/java/com/everymeal/presentation/components/EveryMealBottomSheetDialog.kt b/presentation/src/main/java/com/everymeal/presentation/components/EveryMealBottomSheetDialog.kt index 1b54a029..b2786854 100644 --- a/presentation/src/main/java/com/everymeal/presentation/components/EveryMealBottomSheetDialog.kt +++ b/presentation/src/main/java/com/everymeal/presentation/components/EveryMealBottomSheetDialog.kt @@ -86,8 +86,8 @@ fun EveryMealSortCategoryBottomSheetDialog( Text( modifier = Modifier .fillMaxWidth() - .padding(vertical = 14.dp) - .clickable { onClick("인기순") }, + .clickable { onClick("인기순") } + .padding(vertical = 14.dp), text = stringResource(R.string.popularity_sort), fontSize = 17.sp, color = Gray900, @@ -97,19 +97,19 @@ fun EveryMealSortCategoryBottomSheetDialog( Text( modifier = Modifier .fillMaxWidth() - .padding(vertical = 14.dp) - .clickable { onClick("거리순") }, + .clickable { onClick("거리순") } + .padding(vertical = 14.dp), text = stringResource(R.string.distance_sort), fontSize = 17.sp, color = Gray900, fontWeight = FontWeight.SemiBold, ) - Spacer(modifier = Modifier.padding(10.dp)) + Spacer(modifier = Modifier.padding(4.dp)) Text( modifier = Modifier .fillMaxWidth() - .padding(vertical = 14.dp) - .clickable { onClick("최신순") }, + .clickable { onClick("최신순") } + .padding(vertical = 14.dp), text = stringResource(R.string.recent_sort), fontSize = 17.sp, color = Gray900, diff --git a/presentation/src/main/java/com/everymeal/presentation/ui/detail/DetailListScreen.kt b/presentation/src/main/java/com/everymeal/presentation/ui/detail/DetailListScreen.kt index 162d4bd4..23b90392 100644 --- a/presentation/src/main/java/com/everymeal/presentation/ui/detail/DetailListScreen.kt +++ b/presentation/src/main/java/com/everymeal/presentation/ui/detail/DetailListScreen.kt @@ -15,16 +15,22 @@ import androidx.compose.material3.Scaffold import androidx.compose.material3.Surface import androidx.compose.material3.Text import androidx.compose.runtime.Composable +import androidx.compose.runtime.collectAsState +import androidx.compose.runtime.getValue import androidx.compose.runtime.remember import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.vector.ImageVector +import androidx.compose.ui.res.stringResource import androidx.compose.ui.res.vectorResource import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import androidx.hilt.navigation.compose.hiltViewModel import com.everymeal.presentation.R +import com.everymeal.presentation.components.EveryMealMainBottomSheetDialog +import com.everymeal.presentation.components.EveryMealSortCategoryBottomSheetDialog +import com.everymeal.presentation.ui.home.HomeContract import com.everymeal.presentation.ui.save.SaveTopBar import com.everymeal.presentation.ui.theme.Grey2 import com.everymeal.presentation.ui.theme.Grey7 @@ -36,6 +42,19 @@ fun DetailListScreen( title: String, navigateToPreviousScreen: () -> Unit, ) { + val detailListViewState by detailListViewModel.viewState.collectAsState() + + if (detailListViewState.bottomSheetState) { + EveryMealSortCategoryBottomSheetDialog( + onClick = { + + }, + onDismiss = { + detailListViewModel.setEvent(DetailContract.DetailEvent.BottomSheetStateChange(false)) + } + ) + } + Column( modifier = Modifier .fillMaxSize() @@ -58,7 +77,7 @@ fun DetailListScreen( title = "최신순", isCategory = true, onChipClicked = { - + detailListViewModel.setEvent(DetailContract.DetailEvent.BottomSheetStateChange(true)) } ) Spacer(modifier = Modifier.padding(4.dp)) From e95f0c390793d3725fe08c4fe120ccebd86b3965 Mon Sep 17 00:00:00 2001 From: sgsk88 Date: Sun, 10 Sep 2023 23:40:01 +0900 Subject: [PATCH 16/21] =?UTF-8?q?[feature/more=5Flist]=20DetailListScreen?= =?UTF-8?q?=20=EC=B9=B4=ED=85=8C=EA=B3=A0=EB=A6=AC=20=EB=8F=99=EC=A0=81=20?= =?UTF-8?q?=EC=A0=81=EC=9A=A9=20(#51)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui/detail/DetailListContract.kt | 17 +++++++++++++++++ .../presentation/ui/detail/DetailListScreen.kt | 5 +++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/presentation/src/main/java/com/everymeal/presentation/ui/detail/DetailListContract.kt b/presentation/src/main/java/com/everymeal/presentation/ui/detail/DetailListContract.kt index 192abf77..865450b7 100644 --- a/presentation/src/main/java/com/everymeal/presentation/ui/detail/DetailListContract.kt +++ b/presentation/src/main/java/com/everymeal/presentation/ui/detail/DetailListContract.kt @@ -26,4 +26,21 @@ enum class DetailSortCategoryType { POPULARITY, DISTANCE, RECENT +} + +fun String.DetailSortCategoryType(): DetailSortCategoryType { + return when (this) { + "인기순" -> DetailSortCategoryType.POPULARITY + "거리순" -> DetailSortCategoryType.DISTANCE + "최신순" -> DetailSortCategoryType.RECENT + else -> DetailSortCategoryType.POPULARITY + } +} + +fun DetailSortCategoryType.title(): String { + return when (this) { + DetailSortCategoryType.POPULARITY -> "인기순" + DetailSortCategoryType.DISTANCE -> "거리순" + DetailSortCategoryType.RECENT -> "최신순" + } } \ No newline at end of file diff --git a/presentation/src/main/java/com/everymeal/presentation/ui/detail/DetailListScreen.kt b/presentation/src/main/java/com/everymeal/presentation/ui/detail/DetailListScreen.kt index 23b90392..9af9caa7 100644 --- a/presentation/src/main/java/com/everymeal/presentation/ui/detail/DetailListScreen.kt +++ b/presentation/src/main/java/com/everymeal/presentation/ui/detail/DetailListScreen.kt @@ -47,7 +47,8 @@ fun DetailListScreen( if (detailListViewState.bottomSheetState) { EveryMealSortCategoryBottomSheetDialog( onClick = { - + detailListViewModel.setEvent(DetailContract.DetailEvent.OnClickDetailListCategoryType(it.DetailSortCategoryType())) + detailListViewModel.setEvent(DetailContract.DetailEvent.BottomSheetStateChange(false)) }, onDismiss = { detailListViewModel.setEvent(DetailContract.DetailEvent.BottomSheetStateChange(false)) @@ -74,7 +75,7 @@ fun DetailListScreen( ) { Row { DetailScreenChip( - title = "최신순", + title = detailListViewState.detailSortCategoryType.title(), isCategory = true, onChipClicked = { detailListViewModel.setEvent(DetailContract.DetailEvent.BottomSheetStateChange(true)) From 47765bb68270c1c4a89d36e73587b7e19960ef4a Mon Sep 17 00:00:00 2001 From: sgsk88 Date: Tue, 19 Sep 2023 21:19:38 +0900 Subject: [PATCH 17/21] =?UTF-8?q?[feature/more=5Flist]=20=EC=9D=8C?= =?UTF-8?q?=EC=8B=9D=EC=B9=B4=ED=85=8C=EA=B3=A0=EB=A6=AC=20=EB=8B=A4?= =?UTF-8?q?=EC=9D=B4=EC=96=BC=EB=A1=9C=EA=B7=B8=20=EC=B6=94=EA=B0=80=20(#5?= =?UTF-8?q?1)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/EveryMealBottomSheetDialog.kt | 44 +++++++++++++++++++ .../ui/detail/DetailListContract.kt | 4 +- .../ui/detail/DetailListScreen.kt | 5 +-- .../ui/detail/DetailListViewModel.kt | 2 +- presentation/src/main/res/values/strings.xml | 4 ++ 5 files changed, 52 insertions(+), 7 deletions(-) diff --git a/presentation/src/main/java/com/everymeal/presentation/components/EveryMealBottomSheetDialog.kt b/presentation/src/main/java/com/everymeal/presentation/components/EveryMealBottomSheetDialog.kt index b2786854..67a615ad 100644 --- a/presentation/src/main/java/com/everymeal/presentation/components/EveryMealBottomSheetDialog.kt +++ b/presentation/src/main/java/com/everymeal/presentation/components/EveryMealBottomSheetDialog.kt @@ -118,4 +118,48 @@ fun EveryMealSortCategoryBottomSheetDialog( Spacer(modifier = Modifier.padding(10.dp)) } } +} + +@OptIn(ExperimentalMaterial3Api::class) +@Composable +fun EveryMealCategoryRatingBottomSheetDialog( + onClick: () -> Unit, + onDismiss: () -> Unit +) { + ModalBottomSheet( + onDismissRequest = { onDismiss() }, + containerColor = Color.White, + ) { + Column( + modifier = Modifier + .fillMaxWidth() + .padding(horizontal = 20.dp) + ) { + Text( + modifier = Modifier + .fillMaxWidth() + .padding(vertical = 14.dp), + text = stringResource(R.string.meal_category), + fontSize = 17.sp, + color = Gray900, + fontWeight = FontWeight.SemiBold, + ) + Spacer(modifier = Modifier.padding(4.dp)) + Text( + modifier = Modifier + .fillMaxWidth() + .padding(vertical = 14.dp), + text = stringResource(R.string.rating_category), + fontSize = 17.sp, + color = Gray900, + fontWeight = FontWeight.SemiBold, + ) + Spacer(modifier = Modifier.padding(4.dp)) + EveryMealMainButton( + text = stringResource(R.string.meal_rating_category_apply), + onClick = onClick, + ) + Spacer(modifier = Modifier.padding(10.dp)) + } + } } \ No newline at end of file diff --git a/presentation/src/main/java/com/everymeal/presentation/ui/detail/DetailListContract.kt b/presentation/src/main/java/com/everymeal/presentation/ui/detail/DetailListContract.kt index 865450b7..92aebbce 100644 --- a/presentation/src/main/java/com/everymeal/presentation/ui/detail/DetailListContract.kt +++ b/presentation/src/main/java/com/everymeal/presentation/ui/detail/DetailListContract.kt @@ -9,12 +9,12 @@ class DetailContract { data class DetailState( val uiState: LoadState = LoadState.SUCCESS, val detailSortCategoryType: DetailSortCategoryType = DetailSortCategoryType.POPULARITY, - val bottomSheetState: Boolean = false + val sortBottomSheetState: Boolean = false ) : ViewState sealed class DetailEvent : ViewEvent { data class OnClickDetailListCategoryType(val detailSortCategoryType: DetailSortCategoryType) : DetailEvent() - data class BottomSheetStateChange(val bottomSheetState: Boolean) : DetailEvent() + data class BottomSheetStateChange(val sortBottomSheetState: Boolean) : DetailEvent() } sealed class HomeEffect : ViewSideEffect { diff --git a/presentation/src/main/java/com/everymeal/presentation/ui/detail/DetailListScreen.kt b/presentation/src/main/java/com/everymeal/presentation/ui/detail/DetailListScreen.kt index 9af9caa7..b7b66184 100644 --- a/presentation/src/main/java/com/everymeal/presentation/ui/detail/DetailListScreen.kt +++ b/presentation/src/main/java/com/everymeal/presentation/ui/detail/DetailListScreen.kt @@ -22,15 +22,12 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.vector.ImageVector -import androidx.compose.ui.res.stringResource import androidx.compose.ui.res.vectorResource import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import androidx.hilt.navigation.compose.hiltViewModel import com.everymeal.presentation.R -import com.everymeal.presentation.components.EveryMealMainBottomSheetDialog import com.everymeal.presentation.components.EveryMealSortCategoryBottomSheetDialog -import com.everymeal.presentation.ui.home.HomeContract import com.everymeal.presentation.ui.save.SaveTopBar import com.everymeal.presentation.ui.theme.Grey2 import com.everymeal.presentation.ui.theme.Grey7 @@ -44,7 +41,7 @@ fun DetailListScreen( ) { val detailListViewState by detailListViewModel.viewState.collectAsState() - if (detailListViewState.bottomSheetState) { + if (detailListViewState.sortBottomSheetState) { EveryMealSortCategoryBottomSheetDialog( onClick = { detailListViewModel.setEvent(DetailContract.DetailEvent.OnClickDetailListCategoryType(it.DetailSortCategoryType())) diff --git a/presentation/src/main/java/com/everymeal/presentation/ui/detail/DetailListViewModel.kt b/presentation/src/main/java/com/everymeal/presentation/ui/detail/DetailListViewModel.kt index 0791db1a..1209fefb 100644 --- a/presentation/src/main/java/com/everymeal/presentation/ui/detail/DetailListViewModel.kt +++ b/presentation/src/main/java/com/everymeal/presentation/ui/detail/DetailListViewModel.kt @@ -24,7 +24,7 @@ class DetailListViewModel @Inject constructor( is DetailEvent.BottomSheetStateChange -> { updateState { copy( - bottomSheetState = event.bottomSheetState + sortBottomSheetState = event.sortBottomSheetState ) } } diff --git a/presentation/src/main/res/values/strings.xml b/presentation/src/main/res/values/strings.xml index c140bfd6..0eade226 100644 --- a/presentation/src/main/res/values/strings.xml +++ b/presentation/src/main/res/values/strings.xml @@ -66,4 +66,8 @@ 인기순 거리순 최신순 + + 음식종류 + 별점순 + 적용하기 \ No newline at end of file From 5d0ac5ebe4991043be305e72f4587e652da767e1 Mon Sep 17 00:00:00 2001 From: sgsk88 Date: Tue, 19 Sep 2023 21:31:56 +0900 Subject: [PATCH 18/21] =?UTF-8?q?[feature/more=5Flist]=20DetailListContrac?= =?UTF-8?q?t=20=EC=88=98=EC=A0=95=20(#51)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui/detail/DetailListContract.kt | 6 +++-- .../ui/detail/DetailListScreen.kt | 19 +++++++++++--- .../ui/detail/DetailListViewModel.kt | 25 ++++++++++++++++--- 3 files changed, 41 insertions(+), 9 deletions(-) diff --git a/presentation/src/main/java/com/everymeal/presentation/ui/detail/DetailListContract.kt b/presentation/src/main/java/com/everymeal/presentation/ui/detail/DetailListContract.kt index 92aebbce..73275c4e 100644 --- a/presentation/src/main/java/com/everymeal/presentation/ui/detail/DetailListContract.kt +++ b/presentation/src/main/java/com/everymeal/presentation/ui/detail/DetailListContract.kt @@ -9,12 +9,14 @@ class DetailContract { data class DetailState( val uiState: LoadState = LoadState.SUCCESS, val detailSortCategoryType: DetailSortCategoryType = DetailSortCategoryType.POPULARITY, - val sortBottomSheetState: Boolean = false + val sortBottomSheetState: Boolean = false, + val mealRatingBottomSheetState: Boolean = false, ) : ViewState sealed class DetailEvent : ViewEvent { data class OnClickDetailListCategoryType(val detailSortCategoryType: DetailSortCategoryType) : DetailEvent() - data class BottomSheetStateChange(val sortBottomSheetState: Boolean) : DetailEvent() + data class SortBottomSheetStateChange(val sortBottomSheetState: Boolean) : DetailEvent() + data class MealRatingBottomSheetStateChange(val mealRatingBottomSheetState: Boolean) : DetailEvent() } sealed class HomeEffect : ViewSideEffect { diff --git a/presentation/src/main/java/com/everymeal/presentation/ui/detail/DetailListScreen.kt b/presentation/src/main/java/com/everymeal/presentation/ui/detail/DetailListScreen.kt index b7b66184..8f6a9733 100644 --- a/presentation/src/main/java/com/everymeal/presentation/ui/detail/DetailListScreen.kt +++ b/presentation/src/main/java/com/everymeal/presentation/ui/detail/DetailListScreen.kt @@ -41,14 +41,25 @@ fun DetailListScreen( ) { val detailListViewState by detailListViewModel.viewState.collectAsState() - if (detailListViewState.sortBottomSheetState) { + if(detailListViewState.sortBottomSheetState) { EveryMealSortCategoryBottomSheetDialog( onClick = { detailListViewModel.setEvent(DetailContract.DetailEvent.OnClickDetailListCategoryType(it.DetailSortCategoryType())) - detailListViewModel.setEvent(DetailContract.DetailEvent.BottomSheetStateChange(false)) + detailListViewModel.setEvent(DetailContract.DetailEvent.SortBottomSheetStateChange(false)) }, onDismiss = { - detailListViewModel.setEvent(DetailContract.DetailEvent.BottomSheetStateChange(false)) + detailListViewModel.setEvent(DetailContract.DetailEvent.SortBottomSheetStateChange(false)) + } + ) + } + + if(detailListViewState.mealRatingBottomSheetState) { + EveryMealSortCategoryBottomSheetDialog( + onClick = { + detailListViewModel.setEvent(DetailContract.DetailEvent.MealRatingBottomSheetStateChange(false)) + }, + onDismiss = { + detailListViewModel.setEvent(DetailContract.DetailEvent.MealRatingBottomSheetStateChange(false)) } ) } @@ -75,7 +86,7 @@ fun DetailListScreen( title = detailListViewState.detailSortCategoryType.title(), isCategory = true, onChipClicked = { - detailListViewModel.setEvent(DetailContract.DetailEvent.BottomSheetStateChange(true)) + detailListViewModel.setEvent(DetailContract.DetailEvent.SortBottomSheetStateChange(true)) } ) Spacer(modifier = Modifier.padding(4.dp)) diff --git a/presentation/src/main/java/com/everymeal/presentation/ui/detail/DetailListViewModel.kt b/presentation/src/main/java/com/everymeal/presentation/ui/detail/DetailListViewModel.kt index 1209fefb..69657ad5 100644 --- a/presentation/src/main/java/com/everymeal/presentation/ui/detail/DetailListViewModel.kt +++ b/presentation/src/main/java/com/everymeal/presentation/ui/detail/DetailListViewModel.kt @@ -15,19 +15,38 @@ class DetailListViewModel @Inject constructor( override fun handleEvents(event: DetailEvent) { when (event) { is DetailEvent.OnClickDetailListCategoryType -> { + reflectUpdateState( + detailSortCategoryType = event.detailSortCategoryType + ) + } + is DetailEvent.SortBottomSheetStateChange -> { updateState { copy( - detailSortCategoryType = event.detailSortCategoryType + sortBottomSheetState = event.sortBottomSheetState ) } } - is DetailEvent.BottomSheetStateChange -> { + is DetailEvent.MealRatingBottomSheetStateChange -> { updateState { copy( - sortBottomSheetState = event.sortBottomSheetState + mealRatingBottomSheetState = event.mealRatingBottomSheetState ) } } } } + + private fun reflectUpdateState( + detailSortCategoryType: DetailSortCategoryType = viewState.value.detailSortCategoryType, + sortBottomSheetState: Boolean = viewState.value.sortBottomSheetState, + mealRatingBottomSheetState: Boolean = viewState.value.mealRatingBottomSheetState, + ) { + updateState { + copy( + detailSortCategoryType = detailSortCategoryType, + sortBottomSheetState = sortBottomSheetState, + mealRatingBottomSheetState = mealRatingBottomSheetState, + ) + } + } } \ No newline at end of file From fd8ce9a768dd0c655ff3cd03c538dd7cf7bc0f8f Mon Sep 17 00:00:00 2001 From: sgsk88 Date: Tue, 19 Sep 2023 21:37:37 +0900 Subject: [PATCH 19/21] =?UTF-8?q?[feature/more=5Flist]=20DetailListViewMod?= =?UTF-8?q?el=20State=20=EB=A1=9C=EC=A7=81=20=EB=B3=80=EA=B2=BD=20(#51)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../presentation/ui/detail/DetailListScreen.kt | 5 +++-- .../ui/detail/DetailListViewModel.kt | 16 ++++++---------- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/presentation/src/main/java/com/everymeal/presentation/ui/detail/DetailListScreen.kt b/presentation/src/main/java/com/everymeal/presentation/ui/detail/DetailListScreen.kt index 8f6a9733..de20ee6c 100644 --- a/presentation/src/main/java/com/everymeal/presentation/ui/detail/DetailListScreen.kt +++ b/presentation/src/main/java/com/everymeal/presentation/ui/detail/DetailListScreen.kt @@ -27,6 +27,7 @@ import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import androidx.hilt.navigation.compose.hiltViewModel import com.everymeal.presentation.R +import com.everymeal.presentation.components.EveryMealCategoryRatingBottomSheetDialog import com.everymeal.presentation.components.EveryMealSortCategoryBottomSheetDialog import com.everymeal.presentation.ui.save.SaveTopBar import com.everymeal.presentation.ui.theme.Grey2 @@ -54,7 +55,7 @@ fun DetailListScreen( } if(detailListViewState.mealRatingBottomSheetState) { - EveryMealSortCategoryBottomSheetDialog( + EveryMealCategoryRatingBottomSheetDialog( onClick = { detailListViewModel.setEvent(DetailContract.DetailEvent.MealRatingBottomSheetStateChange(false)) }, @@ -94,7 +95,7 @@ fun DetailListScreen( title = "필터", isCategory = true, onChipClicked = { - + detailListViewModel.setEvent(DetailContract.DetailEvent.MealRatingBottomSheetStateChange(true)) } ) } diff --git a/presentation/src/main/java/com/everymeal/presentation/ui/detail/DetailListViewModel.kt b/presentation/src/main/java/com/everymeal/presentation/ui/detail/DetailListViewModel.kt index 69657ad5..ad07b7d3 100644 --- a/presentation/src/main/java/com/everymeal/presentation/ui/detail/DetailListViewModel.kt +++ b/presentation/src/main/java/com/everymeal/presentation/ui/detail/DetailListViewModel.kt @@ -20,18 +20,14 @@ class DetailListViewModel @Inject constructor( ) } is DetailEvent.SortBottomSheetStateChange -> { - updateState { - copy( - sortBottomSheetState = event.sortBottomSheetState - ) - } + reflectUpdateState( + sortBottomSheetState = event.sortBottomSheetState + ) } is DetailEvent.MealRatingBottomSheetStateChange -> { - updateState { - copy( - mealRatingBottomSheetState = event.mealRatingBottomSheetState - ) - } + reflectUpdateState( + mealRatingBottomSheetState = event.mealRatingBottomSheetState + ) } } } From c765ccab2992238f0001b6c07b830e094c9f7141 Mon Sep 17 00:00:00 2001 From: sgsk88 Date: Tue, 19 Sep 2023 22:37:21 +0900 Subject: [PATCH 20/21] =?UTF-8?q?[feature/more=5Flist]=20RatingCategory=20?= =?UTF-8?q?View=20=EA=B5=AC=ED=98=84=20(#51)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/EveryMealBottomSheetDialog.kt | 68 ++++++++++++++++++- .../ui/detail/DetailListScreen.kt | 6 ++ .../presentation/ui/home/HomeScreen.kt | 5 +- .../main/res/drawable/icon_gray_star_mono.xml | 10 +++ 4 files changed, 87 insertions(+), 2 deletions(-) create mode 100644 presentation/src/main/res/drawable/icon_gray_star_mono.xml diff --git a/presentation/src/main/java/com/everymeal/presentation/components/EveryMealBottomSheetDialog.kt b/presentation/src/main/java/com/everymeal/presentation/components/EveryMealBottomSheetDialog.kt index 67a615ad..7f828d2d 100644 --- a/presentation/src/main/java/com/everymeal/presentation/components/EveryMealBottomSheetDialog.kt +++ b/presentation/src/main/java/com/everymeal/presentation/components/EveryMealBottomSheetDialog.kt @@ -2,25 +2,40 @@ package com.everymeal.presentation.components import androidx.compose.foundation.Image import androidx.compose.foundation.clickable +import androidx.compose.foundation.interaction.MutableInteractionSource +import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size +import androidx.compose.foundation.lazy.LazyRow +import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.ModalBottomSheet +import androidx.compose.material3.Surface import androidx.compose.material3.Text import androidx.compose.runtime.Composable +import androidx.compose.runtime.remember +import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color +import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource +import androidx.compose.ui.res.vectorResource import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import com.everymeal.presentation.R +import com.everymeal.presentation.ui.home.CategoryItem +import com.everymeal.presentation.ui.home.HomeCategoryList import com.everymeal.presentation.ui.theme.Gray600 import com.everymeal.presentation.ui.theme.Gray900 +import com.everymeal.presentation.ui.theme.Grey2 +import com.everymeal.presentation.ui.theme.Grey7 +import com.everymeal.presentation.ui.theme.Typography @OptIn(ExperimentalMaterial3Api::class) @Composable @@ -124,7 +139,9 @@ fun EveryMealSortCategoryBottomSheetDialog( @Composable fun EveryMealCategoryRatingBottomSheetDialog( onClick: () -> Unit, - onDismiss: () -> Unit + onDismiss: () -> Unit, + onCategoryClick: (String) -> Unit, + onRatingClick: (Int) -> Unit ) { ModalBottomSheet( onDismissRequest = { onDismiss() }, @@ -145,6 +162,12 @@ fun EveryMealCategoryRatingBottomSheetDialog( fontWeight = FontWeight.SemiBold, ) Spacer(modifier = Modifier.padding(4.dp)) + HomeCategoryList( + isBottomSheet = true + ) { + onCategoryClick(it) + } + Spacer(modifier = Modifier.padding(4.dp)) Text( modifier = Modifier .fillMaxWidth() @@ -155,6 +178,16 @@ fun EveryMealCategoryRatingBottomSheetDialog( fontWeight = FontWeight.SemiBold, ) Spacer(modifier = Modifier.padding(4.dp)) + LazyRow(content = { + items(5) { + RatingItem( + ratingCount = it + 1, + onRatingClick = onRatingClick + ) + Spacer(modifier = Modifier.padding(4.dp)) + } + }) + Spacer(modifier = Modifier.padding(4.dp)) EveryMealMainButton( text = stringResource(R.string.meal_rating_category_apply), onClick = onClick, @@ -162,4 +195,37 @@ fun EveryMealCategoryRatingBottomSheetDialog( Spacer(modifier = Modifier.padding(10.dp)) } } +} + +@Composable +fun RatingItem( + ratingCount: Int, + onRatingClick: (Int) -> Unit +) { + Surface( + modifier = Modifier.clickable( + indication = null, + interactionSource = remember { MutableInteractionSource() } + ) { onRatingClick(ratingCount) }, + color = Grey2, + shape = RoundedCornerShape(100.dp), + ) { + Row( + verticalAlignment = Alignment.CenterVertically + ) { + Image( + modifier = Modifier + .padding(start = 12.dp) + .size(16.dp), + imageVector = ImageVector.vectorResource(R.drawable.icon_gray_star_mono), + contentDescription = "rating" + ) + Text( + text = ratingCount.toString(), + color = Grey7, + style = Typography.bodySmall, + modifier = Modifier.padding(start = 4.dp, end = 12.dp, top = 6.dp, bottom = 6.dp) + ) + } + } } \ No newline at end of file diff --git a/presentation/src/main/java/com/everymeal/presentation/ui/detail/DetailListScreen.kt b/presentation/src/main/java/com/everymeal/presentation/ui/detail/DetailListScreen.kt index de20ee6c..bfb8f687 100644 --- a/presentation/src/main/java/com/everymeal/presentation/ui/detail/DetailListScreen.kt +++ b/presentation/src/main/java/com/everymeal/presentation/ui/detail/DetailListScreen.kt @@ -61,6 +61,12 @@ fun DetailListScreen( }, onDismiss = { detailListViewModel.setEvent(DetailContract.DetailEvent.MealRatingBottomSheetStateChange(false)) + }, + onCategoryClick = { + + }, + onRatingClick = { + } ) } diff --git a/presentation/src/main/java/com/everymeal/presentation/ui/home/HomeScreen.kt b/presentation/src/main/java/com/everymeal/presentation/ui/home/HomeScreen.kt index 1ab13a05..5f87b963 100644 --- a/presentation/src/main/java/com/everymeal/presentation/ui/home/HomeScreen.kt +++ b/presentation/src/main/java/com/everymeal/presentation/ui/home/HomeScreen.kt @@ -307,12 +307,15 @@ fun HomeMainTopLayout( @Composable fun HomeCategoryList( + isBottomSheet : Boolean = false, onClick: (String) -> Unit ) { + val horizotalDp = if (isBottomSheet) 0.dp else 20.dp + Row( modifier = Modifier .fillMaxWidth() - .padding(horizontal = 20.dp), + .padding(horizontal = horizotalDp), horizontalArrangement = Arrangement.SpaceBetween ) { CategoryItem( diff --git a/presentation/src/main/res/drawable/icon_gray_star_mono.xml b/presentation/src/main/res/drawable/icon_gray_star_mono.xml new file mode 100644 index 00000000..c0c6a8c6 --- /dev/null +++ b/presentation/src/main/res/drawable/icon_gray_star_mono.xml @@ -0,0 +1,10 @@ + + + From e8567d2066b5b3d8cdd369e24c2b6aa8d25faaff Mon Sep 17 00:00:00 2001 From: sgsk88 Date: Thu, 21 Sep 2023 16:16:43 +0900 Subject: [PATCH 21/21] =?UTF-8?q?[feature/more=5Flist]=20=EC=9D=B4?= =?UTF-8?q?=EB=AF=B8=EC=A7=80=20=EC=B6=A9=EB=8F=8C=20=ED=95=B4=EA=B2=B0=20?= =?UTF-8?q?(#51)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/everymeal/presentation/ui/detail/DetailListScreen.kt | 2 +- .../main/res/drawable/{icon_x_mono.xml => icon_x_mono_12.xml} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename presentation/src/main/res/drawable/{icon_x_mono.xml => icon_x_mono_12.xml} (100%) diff --git a/presentation/src/main/java/com/everymeal/presentation/ui/detail/DetailListScreen.kt b/presentation/src/main/java/com/everymeal/presentation/ui/detail/DetailListScreen.kt index bfb8f687..fa97462e 100644 --- a/presentation/src/main/java/com/everymeal/presentation/ui/detail/DetailListScreen.kt +++ b/presentation/src/main/java/com/everymeal/presentation/ui/detail/DetailListScreen.kt @@ -146,7 +146,7 @@ fun DetailScreenChip( modifier = Modifier .padding(end = 12.dp) .size(12.dp), - imageVector = ImageVector.vectorResource(id = R.drawable.icon_x_mono), + imageVector = ImageVector.vectorResource(id = R.drawable.icon_x_mono_12), contentDescription = "close" ) } diff --git a/presentation/src/main/res/drawable/icon_x_mono.xml b/presentation/src/main/res/drawable/icon_x_mono_12.xml similarity index 100% rename from presentation/src/main/res/drawable/icon_x_mono.xml rename to presentation/src/main/res/drawable/icon_x_mono_12.xml