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

[FIX/#47] 갤러리 화면 QA기반 오류 해결 #54

Merged
merged 5 commits into from
Nov 29, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
Expand Up @@ -8,13 +8,15 @@ import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.lazy.grid.GridCells
import androidx.compose.foundation.lazy.grid.GridItemSpan
import androidx.compose.foundation.lazy.grid.LazyVerticalGrid
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.CircularProgressIndicator
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
Expand Down Expand Up @@ -58,15 +60,19 @@ fun GalleryScreen(
Column(
modifier = modifier
.fillMaxSize()
.background(ShinMunGoTheme.color.gray1),
horizontalAlignment = Alignment.CenterHorizontally) {
.background(ShinMunGoTheme.color.gray1)
) {
CommonTopBar(
title = stringResource(R.string.gallery_topbar_title),
onLeftContent = {
IconButton(onClick = onBackClick) {
IconButton(
modifier = Modifier.size(24.dp),
onClick = onBackClick
) {
Icon(
imageVector = ImageVector.vectorResource(R.drawable.ic_arrow_left_line_white_24),
contentDescription = stringResource(R.string.back_screen_text),
modifier = Modifier.size(24.dp),
tint = Color.White
)
}
Expand All @@ -92,44 +98,60 @@ fun GalleryScreen(
.weight(1f)
.fillMaxWidth()
) {
LazyVerticalGrid(
columns = GridCells.Fixed(3),
modifier = Modifier
.fillMaxSize()
.padding(horizontal = 16.dp)
.padding(top = 8.dp),
contentPadding = PaddingValues(1.dp),
when(selectedTab) {
0 -> {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

나중엔 이런 선택지를 enum class로 관리해보세요!

LazyVerticalGrid(
columns = GridCells.Fixed(3),
modifier = Modifier
.fillMaxSize()
.padding(horizontal = 16.dp)
.padding(top = 8.dp),
contentPadding = PaddingValues(1.dp),

) {
item(span = { GridItemSpan(3) }) {
AlertMessageBox(
message = stringResource(R.string.gallery_alert_caption_text),
iconRes = R.drawable.ic_alert_line_red_16,
backgroundColor = ShinMunGoTheme.color.opacityGray13Per5,
textColor = ShinMunGoTheme.color.primaryRed
)
}
) {
item(span = { GridItemSpan(3) }) {
AlertMessageBox(
message = stringResource(R.string.gallery_alert_caption_text),
iconRes = R.drawable.ic_alert_line_red_16,
backgroundColor = ShinMunGoTheme.color.opacityGray13Per5,
textColor = ShinMunGoTheme.color.primaryRed
)
}

uiState.photos.forEach { (date, photos) ->
item(span = { GridItemSpan(3) }) {
PhotoDateTitle(
date = date
)
}
uiState.photos.forEach { (date, photos) ->
item(span = { GridItemSpan(3) }) {
PhotoDateTitle(
date = date
)
}

items(photos.size) { index ->
val photo = photos[index]
PhotoCard(
photo = photo,
isSelected = photo.id in uiState.selectedPhotos,
onPhotoClick = { onPhotoClick(photo.id) },
onCheckboxClick = {
if (photo.id in uiState.selectedPhotos) {
viewModel.onEvent(GalleryEvent.DeselectPhoto(photo.id))
} else {
viewModel.onEvent(GalleryEvent.SelectPhoto(photo.id))
}
items(photos.size) { index ->
val photo = photos[index]
PhotoCard(
photo = photo,
isSelected = photo.id in uiState.selectedPhotos,
onPhotoClick = { onPhotoClick(photo.id) },
onCheckboxClick = {
if (photo.id in uiState.selectedPhotos) {
viewModel.onEvent(GalleryEvent.DeselectPhoto(photo.id))
} else {
viewModel.onEvent(GalleryEvent.SelectPhoto(photo.id))
}
}
)
}
}
}
}
1 -> {
Box(
modifier = Modifier.fillMaxSize(),
contentAlignment = Alignment.Center
) {
Text(
text = stringResource(R.string.gallery_empty_video_text),
style = ShinMunGoTheme.typography.body3,
color = ShinMunGoTheme.color.gray6
)
}
}
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -135,4 +135,5 @@
<string name="gallery_detail_topbar_title">상세보기</string>
<string name="gallery_detail_timestamp_prefix_text">촬영 일시 : %s</string>
<string name="gallery_detail_shinmungo">안전신문고</string>
<string name="gallery_empty_video_text">동영상이 없습니다</string>
</resources>