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

[ISSUE-159] 달력 전환 불가능 할 시 버튼 비활성화 #210

Merged
merged 15 commits into from
Aug 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
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 @@ -56,14 +56,15 @@ fun PlanzExitAppBar(
fun PlanzColorTextWithExitAppBar(
modifier: Modifier = Modifier,
title: String,
onExitClick: () -> Unit,
onClickExitIcon: () -> Unit,
onClickShareIcon: () -> Unit,
isLoading: Boolean,
) {
PlanzColorTextAppBar(
modifier = modifier,
title = title,
menu = PlanzAppBarMenu.EXIT,
onMenuClick = onExitClick,
actionMenus = listOf(PlanzAppBarMenu.SHARE, PlanzAppBarMenu.EXIT),
onClickActionIcons = listOf(onClickShareIcon, onClickExitIcon),
isLoading = isLoading
)
}
Expand Down Expand Up @@ -139,8 +140,8 @@ private fun PlanzAppBar(
private fun PlanzColorTextAppBar(
modifier: Modifier = Modifier,
title: String,
menu: PlanzAppBarMenu? = null,
onMenuClick: () -> Unit,
actionMenus: List<PlanzAppBarMenu>,
onClickActionIcons: List<() -> Unit>,
isLoading: Boolean = false,
) {
if (isLoading) {
Expand Down Expand Up @@ -176,16 +177,20 @@ private fun PlanzColorTextAppBar(
maxLines = 1,
)

if (menu != null) {
Icon(
imageVector = ImageVector.vectorResource(id = menu.icon),
tint = Color.Unspecified,
contentDescription = stringResource(id = menu.contentDescription),
modifier = Modifier
.clip(RoundedCornerShape(30.dp))
.clickable { onMenuClick() }
.align(Alignment.CenterEnd),
)
Row(
modifier = Modifier.align(Alignment.CenterEnd),
horizontalArrangement = Arrangement.spacedBy(8.dp)
) {
actionMenus.forEachIndexed { index, menu ->
Icon(
modifier = Modifier
.clip(RoundedCornerShape(30.dp))
.clickable { onClickActionIcons[index]() },
imageVector = ImageVector.vectorResource(menu.icon),
tint = Color.Unspecified,
contentDescription = stringResource(menu.contentDescription)
)
}
}
}
}
Expand Down Expand Up @@ -214,7 +219,8 @@ fun PlanzExitAppBarPreview() {
fun PreviewPlanzColorTextWithExitAppBar() {
PlanzColorTextWithExitAppBar(
title = "식사",
onExitClick = { },
isLoading = true
onClickShareIcon = {},
onClickExitIcon = {},
isLoading = false
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ import androidx.compose.ui.draw.drawBehind
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.RectangleShape
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.res.vectorResource
import androidx.compose.ui.unit.dp
import androidx.constraintlayout.compose.ConstraintLayout
import androidx.constraintlayout.compose.Dimension
Expand All @@ -34,7 +35,9 @@ fun PlanzPlanDateIndicator(
modifier: Modifier = Modifier,
timeTable: TimeTable,
onClickNextDayButton: () -> Unit,
onClickPreviousDayButton: () -> Unit
onClickPreviousDayButton: () -> Unit,
enablePrev: Boolean,
enableNext: Boolean,
) {

Box(
Expand All @@ -59,9 +62,11 @@ fun PlanzPlanDateIndicator(
bottom.linkTo(parent.bottom)
}) {

PlanzPlanPreviousDayButton(onClick = {
onClickPreviousDayButton()
})
PlanzPlanPreviousDayButton(
enablePrev = enablePrev,
onClick = {
onClickPreviousDayButton()
})
}

LazyRow(
Expand Down Expand Up @@ -90,9 +95,11 @@ fun PlanzPlanDateIndicator(
bottom.linkTo(parent.bottom)
}) {

PlanzPlanNextDayButton(onClick = {
onClickNextDayButton()
})
PlanzPlanNextDayButton(
enableNext = enableNext,
onClick = {
onClickNextDayButton()
})
}
}
}
Expand All @@ -104,7 +111,9 @@ fun CreateTimeTableDateIndicator(
modifier: Modifier = Modifier,
createTimeTable: CreateTimeTable,
onClickNextDayButton: () -> Unit,
onClickPreviousDayButton: () -> Unit
onClickPreviousDayButton: () -> Unit,
enablePrev: Boolean,
enableNext: Boolean,
) {
val borderSize = 1.dp
val borderColor = Gray300
Expand Down Expand Up @@ -136,9 +145,11 @@ fun CreateTimeTableDateIndicator(
bottom.linkTo(parent.bottom)
}) {

PlanzPlanPreviousDayButton(onClick = {
onClickPreviousDayButton()
})
PlanzPlanPreviousDayButton(
enablePrev = enablePrev,
onClick = {
onClickPreviousDayButton()
})
}

LazyRow(
Expand Down Expand Up @@ -167,19 +178,21 @@ fun CreateTimeTableDateIndicator(
bottom.linkTo(parent.bottom)
}) {

PlanzPlanNextDayButton(onClick = {
onClickNextDayButton()
})
PlanzPlanNextDayButton(
enableNext = enableNext,
onClick = {
onClickNextDayButton()
})
}
}
}

}

@Composable
fun PlanzPlanPreviousDayButton(onClick: () -> Unit) {
fun PlanzPlanPreviousDayButton(enablePrev: Boolean, onClick: () -> Unit) {
Icon(
painter = painterResource(id = R.drawable.ic_arrow_box_left_24),
imageVector = if (enablePrev) ImageVector.vectorResource(R.drawable.ic_indicator_left_24) else ImageVector.vectorResource(R.drawable.ic_indicator_left_disable_24),
contentDescription = stringResource(id = R.string.icon_arrow_box_left_24_content_description),
tint = Color.Unspecified,
modifier = Modifier.clickable {
Expand All @@ -189,9 +202,9 @@ fun PlanzPlanPreviousDayButton(onClick: () -> Unit) {
}

@Composable
fun PlanzPlanNextDayButton(onClick: () -> Unit) {
fun PlanzPlanNextDayButton(enableNext: Boolean, onClick: () -> Unit) {
Icon(
painter = painterResource(id = R.drawable.ic_arrow_box_right_24),
imageVector = if (enableNext) ImageVector.vectorResource(R.drawable.ic_indicator_right_24) else ImageVector.vectorResource(R.drawable.ic_indicator_right_disable_24),
contentDescription = stringResource(id = R.string.icon_arrow_box_right_24_content_description),
tint = Color.Unspecified,
modifier = Modifier.clickable {
Expand Down Expand Up @@ -236,14 +249,18 @@ fun CreateTimeTableDayText(date: String) {
text = date.toDayOfWeek(),
color = Gray800,
style = PlanzTypography.caption,
modifier = Modifier.wrapContentSize().align(Alignment.CenterHorizontally)
modifier = Modifier
.wrapContentSize()
.align(Alignment.CenterHorizontally)
)

Text(
text = date.toDay(),
color = MainPurple900,
style = PlanzTypography.body2,
modifier = Modifier.wrapContentSize().align(Alignment.CenterHorizontally)
modifier = Modifier
.wrapContentSize()
.align(Alignment.CenterHorizontally)
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ fun PlanzMenuAppBar(

Row(
modifier = Modifier.align(Alignment.CenterEnd),
horizontalArrangement = Arrangement.spacedBy(6.dp)
horizontalArrangement = Arrangement.spacedBy(8.dp)
) {
actionMenus.forEachIndexed { index, menu ->
Icon(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,21 @@ fun PlanzBackAndClearAppBar(
modifier: Modifier = Modifier,
title: String,
onClickBackIcon: () -> Unit,
onClickShareIcon: () -> Unit,
textIconTitle: String,
textIconColor: Color,
onClickClearIcon: () -> Unit,
onClickClearText: () -> Unit,
clickable: Boolean,
) {
PlanzIconAndTextAppBar(
title = title,
menu = PlanzAppBarMenu.BACK,
onClickIcon = onClickBackIcon,
onClickNavigationIcon = onClickBackIcon,
actionMenu = PlanzAppBarMenu.SHARE,
onClickActionIcon = onClickShareIcon,
textIconTitle = textIconTitle,
textIconColor = textIconColor,
onclickTextIcon = onClickClearIcon
textIconColor = if (clickable) MainPurple900 else textIconColor,
onClickText = onClickClearText
)
}

Expand All @@ -48,10 +52,12 @@ private fun PlanzIconAndTextAppBar(
modifier: Modifier = Modifier,
title: String,
menu: PlanzAppBarMenu,
onClickIcon: () -> Unit,
onClickNavigationIcon: () -> Unit,
actionMenu: PlanzAppBarMenu,
onClickActionIcon: () -> Unit,
textIconTitle: String,
textIconColor: Color,
onclickTextIcon: () -> Unit
onClickText: () -> Unit
) {
Box(
modifier = modifier
Expand All @@ -67,7 +73,7 @@ private fun PlanzIconAndTextAppBar(
modifier = Modifier
.padding(start = menu.horizontalPadding)
.clip(RoundedCornerShape(30.dp))
.clickable { onClickIcon() }
.clickable { onClickNavigationIcon() }
.align(Alignment.CenterStart),
)

Expand All @@ -84,15 +90,32 @@ private fun PlanzIconAndTextAppBar(
overflow = TextOverflow.Ellipsis
)

Text(
text = textIconTitle,
style = PlanzTypography.caption,
color = textIconColor,
Row(
modifier = Modifier
.padding(end = 20.dp)
.align(Alignment.CenterEnd)
.clickable { onclickTextIcon() }
)
.padding(end = 20.dp),
horizontalArrangement = Arrangement.spacedBy(8.dp)
) {

Icon(
modifier = Modifier
.clip(RoundedCornerShape(30.dp))
.clickable { onClickActionIcon() },
imageVector = ImageVector.vectorResource(actionMenu.icon),
tint = Color.Unspecified,
contentDescription = stringResource(menu.contentDescription),
)

Text(
modifier = Modifier
.align(Alignment.CenterVertically)
.clickable { onClickText() },
text = textIconTitle,
style = PlanzTypography.caption,
color = textIconColor,
textAlign = TextAlign.Center,
)
}
}
}

Expand All @@ -102,9 +125,11 @@ fun PlanzIconAndTextAppBarPreview() {
PlanzIconAndTextAppBar(
title = "약속응답",
menu = PlanzAppBarMenu.BACK,
onClickIcon = {},
onClickNavigationIcon = {},
onClickActionIcon = {},
actionMenu = PlanzAppBarMenu.USER,
textIconTitle = stringResource(id = R.string.respond_plan_clear_select_text),
textIconColor = MainPurple900,
onclickTextIcon = {}
onClickText = {}
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import android.net.Uri
import com.google.firebase.dynamiclinks.ktx.*
import com.google.firebase.ktx.Firebase
import com.yapp.growth.presentation.BuildConfig
import com.yapp.growth.presentation.R

const val DYNAMIC_LINK_PARAM = "dynamic_link_param"
const val PLAN_ID_KEY_NAME = "planId"
Expand All @@ -21,11 +22,11 @@ fun getDeepLink(scheme: String, key: String?, id: String?): Uri {

fun onDynamicLinkClick(
context: Context,
scheme: SchemeType,
scheme: SchemeType = SchemeType.RESPOND,
id: String? = null,
thumbNailTitle: String,
thumbNailDescription: String,
thumbNailImageUrl: String,
thumbNailTitle: String = context.getString(R.string.share_thumbnail_title),
thumbNailDescription: String = context.getString(R.string.share_thumbnail_description),
thumbNailImageUrl: String = BuildConfig.BASE_URL + context.getString(R.string.share_plan_share_feed_template_image_url),
) {
Firebase.dynamicLinks.shortLinkAsync {
link = getDeepLink(scheme.name, scheme.key, id)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ class CreateTimeTableContract {
val loadState: LoadState = LoadState.SUCCESS,
val createTimeTable: CreateTimeTable = CreateTimeTable(0,"","", emptyList(), emptyList()),
val clickCount: Int = 0,
val enablePrev: Boolean = false,
val enableNext: Boolean = false,
val isDialogVisible: Boolean = false,
): ViewState

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ fun CreateTimeTableScreen(
CreateTimeTableDateIndicator(
createTimeTable = uiState.createTimeTable,
onClickPreviousDayButton = { viewModel.setEvent(CreateTimeTableEvent.OnClickPreviousDayButton) },
onClickNextDayButton = { viewModel.setEvent(CreateTimeTableEvent.OnClickNextDayButton) }
onClickNextDayButton = { viewModel.setEvent(CreateTimeTableEvent.OnClickNextDayButton) },
enablePrev = uiState.enablePrev,
enableNext = uiState.enableNext,
)

CreateTimeTable(
Expand Down
Loading