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

[#127] 그룹 홈화면 상태에 따른 ui 로직 구현 #134

Merged
merged 13 commits into from
Aug 12, 2024
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,9 @@ import androidx.compose.foundation.layout.wrapContentSize
import androidx.compose.foundation.shape.RoundedCornerShape
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.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
Expand All @@ -39,30 +37,23 @@ fun GroupHomePhotoCard(
eventName: String = "",
onClickEventMake: (Long) -> Unit,
) {
val context = LocalContext.current
val topTitleText = remember(groupInfo.status) {
when (groupInfo.status) {
GroupStatusType.NO_PAST_AND_CURRENT_EVENT -> context.getString(R.string.intro_event_top_title)
GroupStatusType.NO_CURRENT_EVENT -> groupInfo.recentEvent.date
else -> ""
}
}

GroupPhotoCardContainer(
modifier = modifier
.heightIn(max = contentMaxHeight)
.wrapContentSize(),
keywordType = groupInfo.keyword,
backgroundColor = backgroundColor,
) {
if (topTitleText.isNotBlank()) {
CardTopTitle(
modifier = Modifier
.align(Alignment.TopCenter)
.padding(top = 37.dp),
text = topTitleText,
)
}
CardTopTitle(
modifier = Modifier
.align(Alignment.TopCenter)
.padding(top = 37.dp),
text = if (groupInfo.status == GroupStatusType.NO_PAST_AND_CURRENT_EVENT) {
stringResource(id = R.string.intro_event_top_title)
} else {
groupInfo.recentEvent.date
},
)

if (groupInfo.status == GroupStatusType.NO_PAST_AND_CURRENT_EVENT) {
PicNormalButton(
Expand All @@ -76,11 +67,11 @@ fun GroupHomePhotoCard(

content()

if (groupInfo.status == GroupStatusType.NO_CURRENT_EVENT) {
if (groupInfo.status != GroupStatusType.NO_PAST_AND_CURRENT_EVENT) {
EventTitle(
modifier = Modifier
.align(Alignment.BottomCenter)
.padding(top = 31.dp),
.padding(top = 31.dp, bottom = 41.dp),
text = eventName,
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ import com.mashup.gabbangzip.sharedalbum.presentation.theme.Gray20
import com.mashup.gabbangzip.sharedalbum.presentation.theme.Gray80
import com.mashup.gabbangzip.sharedalbum.presentation.theme.PicTypography
import com.mashup.gabbangzip.sharedalbum.presentation.ui.common.FlippableBox
import com.mashup.gabbangzip.sharedalbum.presentation.ui.common.PicNormalButton
import com.mashup.gabbangzip.sharedalbum.presentation.ui.common.PicTag
import com.mashup.gabbangzip.sharedalbum.presentation.ui.common.PicTopBar
import com.mashup.gabbangzip.sharedalbum.presentation.ui.common.model.PicTopBarIcon
Expand All @@ -73,6 +74,7 @@ fun GroupHomeScreen(
onClickMyPage: () -> Unit,
onClickGroupEnter: () -> Unit,
onClickGroupMake: () -> Unit,
onClickSendFcm: () -> Unit,
) {
Box(modifier = Modifier.fillMaxSize()) {
Column(
Expand All @@ -98,6 +100,7 @@ fun GroupHomeScreen(
},
groupInfo = groupInfo,
onGroupDetailClick = onClickGroupDetail,
onClickSendFcm = onClickSendFcm,
onClickEventMake = onClickEventMake,
)

Expand Down Expand Up @@ -129,6 +132,7 @@ private fun GroupContainer(
modifier: Modifier,
groupInfo: GroupInfo,
onGroupDetailClick: (id: Long) -> Unit,
onClickSendFcm: () -> Unit,
onClickEventMake: (Long) -> Unit,
) {
Column(
Expand Down Expand Up @@ -160,6 +164,19 @@ private fun GroupContainer(
groupInfo = groupInfo,
onClickEventMake = onClickEventMake,
)

GroupStatusType
.getButtonRes(groupInfo.status)
?.let { (iconResId, textResId) ->
PicNormalButton(
modifier = Modifier
.padding(top = 16.dp)
.align(Alignment.CenterHorizontally),
iconRes = iconResId,
text = stringResource(textResId),
onButtonClicked = onClickSendFcm,
)
}
}
}

Expand Down Expand Up @@ -549,5 +566,6 @@ private fun GroupHomeScreenPreview() {
onClickMyPage = {},
onClickGroupMake = {},
onClickGroupEnter = {},
onClickSendFcm = {},
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ fun NavGraphBuilder.groupHomeNavGraph(
onClickMyPage: () -> Unit,
onClickGroupMake: () -> Unit,
onClickGroupEnter: () -> Unit,
onClickSendFcm: () -> Unit,
) {
composable(route = MainRoute.GroupHomeRoute.route) {
GroupHomeScreen(
Expand All @@ -26,6 +27,7 @@ fun NavGraphBuilder.groupHomeNavGraph(
onClickMyPage = onClickMyPage,
onClickGroupMake = onClickGroupMake,
onClickGroupEnter = onClickGroupEnter,
onClickSendFcm = onClickSendFcm,
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ fun MainNavHost(
onClickEventMake = { id -> EventCreationActivity.openActivity(context, id) },
onClickGroupMake = { GroupCreationActivity.openActivity(context) },
onClickGroupEnter = { InvitationCodeActivity.openActivity(context) },
onClickSendFcm = { /* TODO : 푸시 알림 */ },
)
groupDetailNavGraph(
onClickGroupMemberButton = { id, keyword ->
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.mashup.gabbangzip.sharedalbum.presentation.ui.model

import com.mashup.gabbangzip.sharedalbum.presentation.R

enum class GroupStatusType {
NO_PAST_AND_CURRENT_EVENT,
NO_CURRENT_EVENT,
Expand All @@ -14,5 +16,23 @@ enum class GroupStatusType {
fun getType(status: String): GroupStatusType {
return entries.associateBy { it.name }[status] ?: NO_PAST_AND_CURRENT_EVENT
}

fun getButtonRes(type: GroupStatusType): Pair<Int, Int>? {
return when (type) {
AFTER_MY_VOTE, AFTER_MY_UPLOAD -> {
Pair(R.drawable.ic_group_notice, R.string.group_home_pic_fcm)
}

BEFORE_MY_UPLOAD -> {
Pair(R.drawable.ic_btn_gallery, R.string.group_home_pic_upload)
}

BEFORE_MY_VOTE -> {
Pair(R.drawable.ic_btn_vote, R.string.group_home_select_pic)
}

else -> null
}
}
}
}
26 changes: 26 additions & 0 deletions presentation/src/main/res/drawable/ic_btn_gallery.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="21dp"
android:height="20dp"
android:viewportWidth="21"
android:viewportHeight="20">
<path
android:pathData="M6.776,0.9L14.776,0.9A5.1,5.1 0,0 1,19.876 6L19.876,14A5.1,5.1 0,0 1,14.776 19.1L6.776,19.1A5.1,5.1 0,0 1,1.676 14L1.676,6A5.1,5.1 0,0 1,6.776 0.9z"
android:strokeWidth="1.8"
android:fillColor="#00000000"
android:strokeColor="#ffffff"/>
<path
android:pathData="M14.11,6.111m-1.667,0a1.667,1.667 0,1 1,3.333 0a1.667,1.667 0,1 1,-3.333 0"
android:fillColor="#ffffff"/>
<group>
<clip-path
android:pathData="M6.776,0L14.776,0A6,6 0,0 1,20.776 6L20.776,14A6,6 0,0 1,14.776 20L6.776,20A6,6 0,0 1,0.776 14L0.776,6A6,6 0,0 1,6.776 0z"/>
<group>
<clip-path
android:pathData="M16.611,23.332C13.69,23.332 9.512,22.98 6.608,23.288C6.335,23.317 6.058,23.332 5.778,23.332C1.482,23.332 -2,19.85 -2,15.554C-2,11.259 1.482,7.776 5.778,7.776C7.767,7.776 9.581,8.523 10.956,9.751C12.365,11.009 14.723,11.665 16.611,11.665C19.832,11.665 22.444,14.277 22.444,17.498C22.444,20.72 19.832,23.332 16.611,23.332Z"
android:fillType="evenOdd"/>
<path
android:pathData="M6.418,21.498C6.208,21.521 5.995,21.532 5.778,21.532V25.132C6.122,25.132 6.462,25.114 6.797,25.078L6.418,21.498ZM5.778,21.532C2.476,21.532 -0.2,18.856 -0.2,15.554H-3.8C-3.8,20.844 0.488,25.132 5.778,25.132V21.532ZM-0.2,15.554C-0.2,12.253 2.476,9.576 5.778,9.576V5.976C0.488,5.976 -3.8,10.264 -3.8,15.554H-0.2ZM5.778,9.576C7.308,9.576 8.699,10.149 9.757,11.094L12.155,8.408C10.463,6.897 8.226,5.976 5.778,5.976V9.576ZM16.611,13.465C18.838,13.465 20.644,15.271 20.644,17.498H24.244C24.244,13.283 20.826,9.865 16.611,9.865V13.465ZM20.644,17.498C20.644,19.726 18.838,21.532 16.611,21.532V25.132C20.826,25.132 24.244,21.714 24.244,17.498H20.644ZM9.757,11.094C11.592,12.731 14.429,13.465 16.611,13.465V9.865C15.017,9.865 13.137,9.285 12.155,8.408L9.757,11.094ZM6.797,25.078C8.119,24.938 9.784,24.944 11.553,24.994C13.264,25.041 15.119,25.132 16.611,25.132V21.532C15.181,21.532 13.487,21.446 11.653,21.395C9.877,21.346 8.001,21.33 6.418,21.498L6.797,25.078Z"
android:fillColor="#ffffff"/>
</group>
</group>
</vector>
10 changes: 10 additions & 0 deletions presentation/src/main/res/drawable/ic_btn_vote.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="20dp"
android:height="20dp"
android:viewportWidth="20"
android:viewportHeight="20">
<path
android:pathData="M2.851,4.919C2.851,3.373 4.104,2.119 5.651,2.119H14.402C15.948,2.119 17.202,3.373 17.202,4.919V15.67C17.202,15.708 17.199,15.744 17.194,15.78H19.135C19.577,15.78 19.935,16.138 19.935,16.58C19.935,17.022 19.577,17.38 19.135,17.38H0.919C0.477,17.38 0.119,17.022 0.119,16.58C0.119,16.138 0.477,15.78 0.919,15.78H2.858C2.853,15.744 2.851,15.708 2.851,15.67V4.919ZM15.602,15.67C15.602,15.708 15.604,15.744 15.609,15.78H4.443C4.448,15.744 4.451,15.708 4.451,15.67V4.919C4.451,4.256 4.988,3.719 5.651,3.719H14.402C15.065,3.719 15.602,4.256 15.602,4.919V15.67ZM13.78,8.038C14.092,7.725 14.092,7.219 13.78,6.906C13.468,6.594 12.961,6.594 12.649,6.906L9.116,10.439L7.86,9.183C7.547,8.871 7.041,8.871 6.728,9.183C6.416,9.496 6.416,10.002 6.728,10.315L8.55,12.136C8.862,12.449 9.369,12.449 9.681,12.136L13.78,8.038Z"
android:fillColor="#ffffff"
android:fillType="evenOdd"/>
</vector>
3 changes: 3 additions & 0 deletions presentation/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -128,4 +128,7 @@
<string name="floating_btn_desc">플로팅 버튼 아이콘</string>
<string name="floating_btn">플로팅 버튼</string>
<string name="floating_animate">FloatingRotationAngle</string>
<string name="group_home_pic_fcm">쿡 찌르기</string>
<string name="group_home_pic_upload">내 PIC 올리기</string>
<string name="group_home_select_pic">픽 고르기</string>
</resources>
Loading