Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature/more_list] 맛집 카테고리 별 상세 화면에 들어갈 바텀다이얼로그 구현 #57

Merged
merged 23 commits into from
Sep 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
11c6b71
[feature/more_list] 상세 리스트 화면 타이틀 전체 틀 구현 (#51)
SsongSik Sep 5, 2023
2b34219
[feature/more_list] 카테고리 Chip 구현 (#51)
SsongSik Sep 5, 2023
44d0022
[feature/more_list] 카테고리 Spacer, Chip 구현 (#51)
SsongSik Sep 5, 2023
e9a8dbe
[feature/more_list] HomeScreen Navigation 스크린 추가 (#51)
SsongSik Sep 5, 2023
f9f03e8
Merge remote-tracking branch 'origin/develop' into feature/more_list
SsongSik Sep 5, 2023
4ae4759
[feature/more_list] develop 충돌 해결 (#51)
SsongSik Sep 5, 2023
90394db
[feature/more_list] 상세 리스트 화면 이동 (#51)
SsongSik Sep 5, 2023
fd06ab6
[feature/more_list] 상세 리스트 화면 바텀네비게이션 제거 (#51)
SsongSik Sep 5, 2023
c3f6dcd
[feature/more_list] 상세화면 argument 추가 (#51)
SsongSik Sep 5, 2023
eb3b0d7
[feature/more_list] argument 전달 상세화면으로 (#51)
SsongSik Sep 5, 2023
caaa94d
[feature/more_list] x Image 분기처리 추가 및 Click indication 제거 (#51)
SsongSik Sep 7, 2023
5875714
[feature/more_list] 텍스트 클릭영역 추가 (#51)
SsongSik Sep 7, 2023
1c586b5
[feature/more_list] DetailContract 생성 (#51)
SsongSik Sep 7, 2023
1f041b7
[feature/more_list] DetailViewModel 생성 (#51)
SsongSik Sep 8, 2023
1dd7231
[feature/more_list] DetailScreen Click 리스너 추가 (#51)
SsongSik Sep 8, 2023
9921437
[feature/more_list] DetailListScreen ViewModel 연결 (#51)
SsongSik Sep 10, 2023
e95f0c3
[feature/more_list] DetailListScreen 카테고리 동적 적용 (#51)
SsongSik Sep 10, 2023
47765bb
[feature/more_list] 음식카테고리 다이얼로그 추가 (#51)
SsongSik Sep 19, 2023
5d0ac5e
[feature/more_list] DetailListContract 수정 (#51)
SsongSik Sep 19, 2023
fd8ce9a
[feature/more_list] DetailListViewModel State 로직 변경 (#51)
SsongSik Sep 19, 2023
c765cca
[feature/more_list] RatingCategory View 구현 (#51)
SsongSik Sep 19, 2023
e8567d2
[feature/more_list] 이미지 충돌 해결 (#51)
SsongSik Sep 21, 2023
1b4051f
Merge branch 'develop' into feature/more_list
SsongSik Sep 21, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,25 +1,41 @@
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
Expand Down Expand Up @@ -65,4 +81,151 @@ fun EveryMealMainBottomSheetDialog(
Spacer(modifier = Modifier.padding(10.dp))
}
}
}

@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun EveryMealSortCategoryBottomSheetDialog(
onClick: (String) -> Unit,
onDismiss: () -> Unit
) {
ModalBottomSheet(
onDismissRequest = { onDismiss() },
containerColor = Color.White,
) {
Column(
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = 20.dp)
) {
Text(
modifier = Modifier
.fillMaxWidth()
.clickable { onClick("인기순") }
.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(
modifier = Modifier
.fillMaxWidth()
.clickable { onClick("거리순") }
.padding(vertical = 14.dp),
text = stringResource(R.string.distance_sort),
fontSize = 17.sp,
color = Gray900,
fontWeight = FontWeight.SemiBold,
)
Spacer(modifier = Modifier.padding(4.dp))
Text(
modifier = Modifier
.fillMaxWidth()
.clickable { onClick("최신순") }
.padding(vertical = 14.dp),
text = stringResource(R.string.recent_sort),
fontSize = 17.sp,
color = Gray900,
fontWeight = FontWeight.SemiBold,
)
Spacer(modifier = Modifier.padding(10.dp))
}
}
}

@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun EveryMealCategoryRatingBottomSheetDialog(
onClick: () -> Unit,
onDismiss: () -> Unit,
onCategoryClick: (String) -> Unit,
onRatingClick: (Int) -> 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))
HomeCategoryList(
isBottomSheet = true
) {
onCategoryClick(it)
}
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))
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,
)
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)
)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,8 @@ fun RestaurantImage(restaurant: Restaurant) {
@Composable
fun HomeScreenPreview() {
EveryMeal_AndroidTheme {
HomeScreen()
HomeScreen() {

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
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 sortBottomSheetState: Boolean = false,
val mealRatingBottomSheetState: Boolean = false,
) : ViewState

sealed class DetailEvent : ViewEvent {
data class OnClickDetailListCategoryType(val detailSortCategoryType: DetailSortCategoryType) : DetailEvent()
data class SortBottomSheetStateChange(val sortBottomSheetState: Boolean) : DetailEvent()
data class MealRatingBottomSheetStateChange(val mealRatingBottomSheetState: Boolean) : DetailEvent()
}

sealed class HomeEffect : ViewSideEffect {

}
}

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 -> "최신순"
}
}
Loading