diff --git a/presenter/src/main/java/com/mashup/twotoo/presenter/garden/GardenComponents.kt b/presenter/src/main/java/com/mashup/twotoo/presenter/garden/GardenComponents.kt index 88bca7de..85b34918 100644 --- a/presenter/src/main/java/com/mashup/twotoo/presenter/garden/GardenComponents.kt +++ b/presenter/src/main/java/com/mashup/twotoo/presenter/garden/GardenComponents.kt @@ -30,6 +30,7 @@ import com.mashup.twotoo.presenter.R import com.mashup.twotoo.presenter.designsystem.component.TwoTooImageView import com.mashup.twotoo.presenter.designsystem.theme.TwoTooRound10 import com.mashup.twotoo.presenter.designsystem.theme.TwoTooTheme +import com.mashup.twotoo.presenter.designsystem.theme.TwotooPink import com.mashup.twotoo.presenter.garden.model.ChallengeCardInfoUiModel import com.mashup.twotoo.presenter.garden.model.FlowerHead @@ -97,14 +98,18 @@ private fun ChallengeInfo(challengeCardInfoUiModel: ChallengeCardInfoUiModel) { ) { Text( text = stringResource( - id = if (challengeCardInfoUiModel.viewState == "InProgress") { + id = if (challengeCardInfoUiModel.viewState.isInProgress()) { R.string.inProgressChallengeAttempts } else { R.string.challengeAttempts }, challengeCardInfoUiModel.attempts, ), - color = TwoTooTheme.color.mainPink, + color = if (challengeCardInfoUiModel.viewState.isInProgress()) { + TwoTooTheme.color.mainPink + } else { + TwotooPink + }, ) Text( modifier = Modifier.padding(top = 16.dp), @@ -120,6 +125,10 @@ private fun ChallengeInfo(challengeCardInfoUiModel: ChallengeCardInfoUiModel) { } } +private fun String.isInProgress(): Boolean { + return this == "InProgress" +} + @Composable private fun BoxScope.Flowers(challengeCardInfoUiModel: ChallengeCardInfoUiModel) { Row( @@ -130,23 +139,34 @@ private fun BoxScope.Flowers(challengeCardInfoUiModel: ChallengeCardInfoUiModel) val context = LocalContext.current val screenWidth = LocalConfiguration.current.screenWidthDp val screenHeight = LocalConfiguration.current.screenHeightDp - val meFlower = FlowerHead(challengeCardInfoUiModel.meFlower).getFlowerImage(context, screenWidth, screenHeight) - val partnerFlower = FlowerHead(challengeCardInfoUiModel.partnerFlower).getFlowerImage(context, screenWidth, screenHeight) - val isUser1Success = challengeCardInfoUiModel.user1CommitCnt > 15 - val isUser2Success = challengeCardInfoUiModel.user2CommitCnt > 15 - TwoTooImageView( - modifier = Modifier.size(meFlower.width, meFlower.height), - model = if (isUser1Success) meFlower.image else R.drawable.img_not_success, - contentScale = ContentScale.Fit, - previewPlaceholder = R.drawable.img_head_fig_sm, - ) - TwoTooImageView( - modifier = Modifier.size(partnerFlower.width, partnerFlower.height), - model = if (isUser2Success) partnerFlower.image else R.drawable.img_not_success, - contentScale = ContentScale.Fit, - previewPlaceholder = R.drawable.img_head_camellia_sm, - ) + if (challengeCardInfoUiModel.viewState.isInProgress()) { + val inProgressImageHeight = 64 * screenHeight / 812 + TwoTooImageView( + modifier = Modifier.padding(horizontal = 29.dp).fillMaxWidth().height(inProgressImageHeight.dp), + model = R.drawable.img_challenge_in_progress, + previewPlaceholder = R.drawable.img_challenge_in_progress, + contentScale = ContentScale.Fit, + ) + } else { + val meFlower = FlowerHead(challengeCardInfoUiModel.meFlower).getFlowerImage(context, screenWidth, screenHeight) + val partnerFlower = FlowerHead(challengeCardInfoUiModel.partnerFlower).getFlowerImage(context, screenWidth, screenHeight) + val isUser1Success = challengeCardInfoUiModel.user1CommitCnt > 15 + val isUser2Success = challengeCardInfoUiModel.user2CommitCnt > 15 + + TwoTooImageView( + modifier = Modifier.size(meFlower.width, meFlower.height), + model = if (isUser1Success) meFlower.image else R.drawable.img_not_success, + contentScale = ContentScale.Fit, + previewPlaceholder = R.drawable.img_head_fig_sm, + ) + TwoTooImageView( + modifier = Modifier.size(partnerFlower.width, partnerFlower.height), + model = if (isUser2Success) partnerFlower.image else R.drawable.img_not_success, + contentScale = ContentScale.Fit, + previewPlaceholder = R.drawable.img_head_camellia_sm, + ) + } } } diff --git a/presenter/src/main/java/com/mashup/twotoo/presenter/garden/model/ChallengeCardInfoUiModel.kt b/presenter/src/main/java/com/mashup/twotoo/presenter/garden/model/ChallengeCardInfoUiModel.kt index b38caf62..29ff8160 100644 --- a/presenter/src/main/java/com/mashup/twotoo/presenter/garden/model/ChallengeCardInfoUiModel.kt +++ b/presenter/src/main/java/com/mashup/twotoo/presenter/garden/model/ChallengeCardInfoUiModel.kt @@ -17,9 +17,9 @@ data class ChallengeCardInfoUiModel( // Todo 14지우고 garden Card challengeNo와 매핑해야함. val default: List = listOf( ChallengeCardInfoUiModel(viewState = "InProgress", 14, 1, "하루 30분 운동하기", "2023/05/01 ~ 05/22", FlowerName.Fig, FlowerName.Camellia), - ChallengeCardInfoUiModel(viewState = "InProgress", 14, 2, "아침 밥 먹기", "2023/05/01 ~ 05/22", FlowerName.Fig, FlowerName.Camellia), - ChallengeCardInfoUiModel(viewState = "InProgress", 14, 3, "하루 2시간 공부하기", "2023/05/01 ~ 05/22", FlowerName.Fig, FlowerName.Camellia), - ChallengeCardInfoUiModel(viewState = "InProgress", 14, 4, "하루 책 20page 읽기", "2023/05/01 ~ 05/22", FlowerName.Fig, FlowerName.Camellia), + ChallengeCardInfoUiModel(viewState = "Complete", 15, 2, "아침 밥 먹기", "2023/05/01 ~ 05/22", FlowerName.Fig, FlowerName.Camellia), + ChallengeCardInfoUiModel(viewState = "Complete", 16, 3, "하루 2시간 공부하기", "2023/05/01 ~ 05/22", FlowerName.Fig, FlowerName.Camellia), + ChallengeCardInfoUiModel(viewState = "Complete", 17, 4, "하루 책 20page 읽기", "2023/05/01 ~ 05/22", FlowerName.Fig, FlowerName.Camellia), ) } } diff --git a/presenter/src/main/res/drawable-hdpi/img_challenge_in_progress.png b/presenter/src/main/res/drawable-hdpi/img_challenge_in_progress.png new file mode 100644 index 00000000..f14956d5 Binary files /dev/null and b/presenter/src/main/res/drawable-hdpi/img_challenge_in_progress.png differ diff --git a/presenter/src/main/res/drawable-xhdpi/img_challenge_in_progress.png b/presenter/src/main/res/drawable-xhdpi/img_challenge_in_progress.png new file mode 100644 index 00000000..c5c408ef Binary files /dev/null and b/presenter/src/main/res/drawable-xhdpi/img_challenge_in_progress.png differ diff --git a/presenter/src/main/res/drawable-xxhdpi/img_challenge_in_progress.png b/presenter/src/main/res/drawable-xxhdpi/img_challenge_in_progress.png new file mode 100644 index 00000000..5f7f4ccd Binary files /dev/null and b/presenter/src/main/res/drawable-xxhdpi/img_challenge_in_progress.png differ diff --git a/presenter/src/main/res/drawable-xxxhdpi/img_challenge_in_progress.png b/presenter/src/main/res/drawable-xxxhdpi/img_challenge_in_progress.png new file mode 100644 index 00000000..d3bc7a6e Binary files /dev/null and b/presenter/src/main/res/drawable-xxxhdpi/img_challenge_in_progress.png differ