From 2d8455b8595ffcc1e0cc18d41e34bbc2832ba4bf Mon Sep 17 00:00:00 2001 From: Hyunkuk Date: Mon, 2 Oct 2023 17:14:18 +0900 Subject: [PATCH 1/9] =?UTF-8?q?[feat]=20=EB=AC=BC=EB=BF=8C=EB=A6=AC?= =?UTF-8?q?=EA=B0=9C=20=EB=A7=90=ED=92=8D=EC=84=A0=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/loading/LoadingIndicator.kt | 57 ++++++++++++++++--- .../home/ongoing/components/HomeFlower.kt | 9 ++- .../main/res/drawable/ic_bubble_wrapper.xml | 12 ++++ 3 files changed, 67 insertions(+), 11 deletions(-) create mode 100644 presenter/src/main/res/drawable/ic_bubble_wrapper.xml diff --git a/presenter/src/main/java/com/mashup/twotoo/presenter/designsystem/component/loading/LoadingIndicator.kt b/presenter/src/main/java/com/mashup/twotoo/presenter/designsystem/component/loading/LoadingIndicator.kt index 3c262499..d4ee0342 100644 --- a/presenter/src/main/java/com/mashup/twotoo/presenter/designsystem/component/loading/LoadingIndicator.kt +++ b/presenter/src/main/java/com/mashup/twotoo/presenter/designsystem/component/loading/LoadingIndicator.kt @@ -6,12 +6,18 @@ import androidx.compose.animation.core.animateFloat import androidx.compose.animation.core.infiniteRepeatable import androidx.compose.animation.core.rememberInfiniteTransition import androidx.compose.animation.core.tween +import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.width import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.graphicsLayer import androidx.compose.ui.layout.ContentScale +import androidx.compose.ui.platform.LocalConfiguration import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.dp +import androidx.constraintlayout.compose.ConstraintLayout import com.airbnb.lottie.compose.LottieAnimation import com.airbnb.lottie.compose.LottieCompositionSpec import com.airbnb.lottie.compose.LottieConstants @@ -36,14 +42,45 @@ fun WaterLoadingIndicator( label = "", ) - TwoTooImageView( - modifier = modifier.graphicsLayer { - rotationZ = rotation - }, - model = R.drawable.img_watering, - previewPlaceholder = R.drawable.img_watering, - contentScale = ContentScale.Fit, - ) + ConstraintLayout( + modifier = modifier, + ) { + val (waterWrapper, waterImage) = createRefs() + val screenHeight = LocalConfiguration.current.screenHeightDp + val areaMargin = 14.dp * screenHeight / 812 + TwoTooImageView( + modifier = Modifier.constrainAs(waterWrapper) { + linkTo( + top = parent.top, + start = parent.start, + end = parent.end, + bottom = parent.bottom, + ) + }, + model = R.drawable.ic_bubble_wrapper, + previewPlaceholder = R.drawable.ic_bubble_wrapper, + contentScale = ContentScale.Fit, + ) + TwoTooImageView( + modifier = Modifier.padding( + top = areaMargin, + bottom = areaMargin * 2, + start = areaMargin, + end = areaMargin, + ) + .constrainAs(waterImage) { + start.linkTo(parent.start) + end.linkTo(parent.end) + top.linkTo(parent.top) + bottom.linkTo(parent.bottom) + }.graphicsLayer { + rotationZ = rotation + }, + model = R.drawable.img_watering, + previewPlaceholder = R.drawable.img_watering, + contentScale = ContentScale.Fit, + ) + } } @Composable @@ -63,7 +100,9 @@ fun FlowerLoadingIndicator( @Composable fun PreviewWaterIndicator() { TwoTooTheme { - WaterLoadingIndicator() + WaterLoadingIndicator( + modifier = Modifier.width(75.dp).height(69.dp), + ) } } diff --git a/presenter/src/main/java/com/mashup/twotoo/presenter/home/ongoing/components/HomeFlower.kt b/presenter/src/main/java/com/mashup/twotoo/presenter/home/ongoing/components/HomeFlower.kt index 65edf275..bd139349 100644 --- a/presenter/src/main/java/com/mashup/twotoo/presenter/home/ongoing/components/HomeFlower.kt +++ b/presenter/src/main/java/com/mashup/twotoo/presenter/home/ongoing/components/HomeFlower.kt @@ -67,6 +67,11 @@ fun HomeFlowerMeAndPartner( partnerCheer, meCheer, heartImage, partnerFlowerLanguage, meFlowerLanguage, ) = createRefs() + val screenWidth = LocalConfiguration.current.screenWidthDp + val screenHeight = LocalConfiguration.current.screenHeightDp + val bubbleWidth = 75.dp * screenWidth / 375 + val bubbleHeight = 69.dp * screenHeight / 812 + when (homeChallengeStateUiModel.challengeStateUiModel) { is HomeFlowerPartnerAndMeUiModel -> with(homeChallengeStateUiModel.challengeStateUiModel) { if (homeChallengeStateUiModel.challengeState == Complete) { @@ -161,8 +166,8 @@ fun HomeFlowerMeAndPartner( .testTag( stringResource(id = R.string.homeOngoingChallengeWaterImage), ) - .width(69.dp) - .height(42.dp) + .width(bubbleWidth) + .height(bubbleHeight) .constrainAs(waterImage) { top.linkTo(textHint.bottom) bottom.linkTo(me.top, margin = 8.dp) diff --git a/presenter/src/main/res/drawable/ic_bubble_wrapper.xml b/presenter/src/main/res/drawable/ic_bubble_wrapper.xml new file mode 100644 index 00000000..1cd01d70 --- /dev/null +++ b/presenter/src/main/res/drawable/ic_bubble_wrapper.xml @@ -0,0 +1,12 @@ + + + + From 29ba39dc625088eecb05003cad82324a046cd0c7 Mon Sep 17 00:00:00 2001 From: Hyunkuk Date: Mon, 2 Oct 2023 17:17:47 +0900 Subject: [PATCH 2/9] =?UTF-8?q?[refactor]=20padding=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../designsystem/component/loading/LoadingIndicator.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/presenter/src/main/java/com/mashup/twotoo/presenter/designsystem/component/loading/LoadingIndicator.kt b/presenter/src/main/java/com/mashup/twotoo/presenter/designsystem/component/loading/LoadingIndicator.kt index d4ee0342..16779de1 100644 --- a/presenter/src/main/java/com/mashup/twotoo/presenter/designsystem/component/loading/LoadingIndicator.kt +++ b/presenter/src/main/java/com/mashup/twotoo/presenter/designsystem/component/loading/LoadingIndicator.kt @@ -47,7 +47,8 @@ fun WaterLoadingIndicator( ) { val (waterWrapper, waterImage) = createRefs() val screenHeight = LocalConfiguration.current.screenHeightDp - val areaMargin = 14.dp * screenHeight / 812 + val areaMargin = 12.dp * screenHeight / 812 + val bottomSpace = 14.dp * screenHeight / 812 TwoTooImageView( modifier = Modifier.constrainAs(waterWrapper) { linkTo( @@ -64,7 +65,7 @@ fun WaterLoadingIndicator( TwoTooImageView( modifier = Modifier.padding( top = areaMargin, - bottom = areaMargin * 2, + bottom = areaMargin + bottomSpace, start = areaMargin, end = areaMargin, ) From 3a29b1a6f7331a25fbd7df729aff95da88a62b9e Mon Sep 17 00:00:00 2001 From: Hyunkuk Date: Mon, 2 Oct 2023 18:34:25 +0900 Subject: [PATCH 3/9] [refactor] rename --- .../designsystem/component/loading/LoadingIndicator.kt | 4 ++-- .../{ic_bubble_wrapper.xml => ic_water_bubble_wrapper.xml} | 0 2 files changed, 2 insertions(+), 2 deletions(-) rename presenter/src/main/res/drawable/{ic_bubble_wrapper.xml => ic_water_bubble_wrapper.xml} (100%) diff --git a/presenter/src/main/java/com/mashup/twotoo/presenter/designsystem/component/loading/LoadingIndicator.kt b/presenter/src/main/java/com/mashup/twotoo/presenter/designsystem/component/loading/LoadingIndicator.kt index 16779de1..e784d8e8 100644 --- a/presenter/src/main/java/com/mashup/twotoo/presenter/designsystem/component/loading/LoadingIndicator.kt +++ b/presenter/src/main/java/com/mashup/twotoo/presenter/designsystem/component/loading/LoadingIndicator.kt @@ -58,8 +58,8 @@ fun WaterLoadingIndicator( bottom = parent.bottom, ) }, - model = R.drawable.ic_bubble_wrapper, - previewPlaceholder = R.drawable.ic_bubble_wrapper, + model = R.drawable.ic_water_bubble_wrapper, + previewPlaceholder = R.drawable.ic_water_bubble_wrapper, contentScale = ContentScale.Fit, ) TwoTooImageView( diff --git a/presenter/src/main/res/drawable/ic_bubble_wrapper.xml b/presenter/src/main/res/drawable/ic_water_bubble_wrapper.xml similarity index 100% rename from presenter/src/main/res/drawable/ic_bubble_wrapper.xml rename to presenter/src/main/res/drawable/ic_water_bubble_wrapper.xml From d1f1c2aa7da9c5473bda9ac2f4f13b7a79bf27ac Mon Sep 17 00:00:00 2001 From: Hyunkuk Date: Mon, 2 Oct 2023 18:36:16 +0900 Subject: [PATCH 4/9] =?UTF-8?q?[feat]=20=EA=BD=83=EB=A7=90=20=ED=99=95?= =?UTF-8?q?=EC=9D=B8=20=EC=9D=B4=EB=AF=B8=EC=A7=80=EC=99=80=20=ED=85=8D?= =?UTF-8?q?=EC=8A=A4=ED=8A=B8=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../drawable/ic_flower_text_bubble_textflower.xml | 15 +++++++++++++++ .../drawable/ic_flower_text_bubble_wrapper.xml | 12 ++++++++++++ presenter/src/main/res/values/string.xml | 1 + 3 files changed, 28 insertions(+) create mode 100644 presenter/src/main/res/drawable/ic_flower_text_bubble_textflower.xml create mode 100644 presenter/src/main/res/drawable/ic_flower_text_bubble_wrapper.xml diff --git a/presenter/src/main/res/drawable/ic_flower_text_bubble_textflower.xml b/presenter/src/main/res/drawable/ic_flower_text_bubble_textflower.xml new file mode 100644 index 00000000..5d22d319 --- /dev/null +++ b/presenter/src/main/res/drawable/ic_flower_text_bubble_textflower.xml @@ -0,0 +1,15 @@ + + + + + diff --git a/presenter/src/main/res/drawable/ic_flower_text_bubble_wrapper.xml b/presenter/src/main/res/drawable/ic_flower_text_bubble_wrapper.xml new file mode 100644 index 00000000..ccfe36a2 --- /dev/null +++ b/presenter/src/main/res/drawable/ic_flower_text_bubble_wrapper.xml @@ -0,0 +1,12 @@ + + + + diff --git a/presenter/src/main/res/values/string.xml b/presenter/src/main/res/values/string.xml index ebb3d55c..2d809a4b 100644 --- a/presenter/src/main/res/values/string.xml +++ b/presenter/src/main/res/values/string.xml @@ -81,6 +81,7 @@ 내 응원 전 풍선 칭찬 문구 작성하기 + 꽃말 보기 From 2cca61a35c301ec1508095ed8e34bae5cbde502a Mon Sep 17 00:00:00 2001 From: Hyunkuk Date: Mon, 2 Oct 2023 18:36:34 +0900 Subject: [PATCH 5/9] =?UTF-8?q?[feat]=20=EA=BD=83=EB=A7=90=20=ED=99=95?= =?UTF-8?q?=EC=9D=B8=20=EB=B2=84=EB=B8=94=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ongoing/components/HomeFlowerLanguage.kt | 83 ++++++++++++++----- 1 file changed, 63 insertions(+), 20 deletions(-) diff --git a/presenter/src/main/java/com/mashup/twotoo/presenter/home/ongoing/components/HomeFlowerLanguage.kt b/presenter/src/main/java/com/mashup/twotoo/presenter/home/ongoing/components/HomeFlowerLanguage.kt index 4437eaa5..b3f66fe7 100644 --- a/presenter/src/main/java/com/mashup/twotoo/presenter/home/ongoing/components/HomeFlowerLanguage.kt +++ b/presenter/src/main/java/com/mashup/twotoo/presenter/home/ongoing/components/HomeFlowerLanguage.kt @@ -1,42 +1,82 @@ package com.mashup.twotoo.presenter.home.ongoing.components -import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.clickable +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.size +import androidx.compose.foundation.layout.width import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier +import androidx.compose.ui.layout.ContentScale +import androidx.compose.ui.platform.LocalConfiguration import androidx.compose.ui.platform.LocalContext -import androidx.compose.ui.text.style.TextAlign +import androidx.compose.ui.res.stringResource import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp +import androidx.constraintlayout.compose.ConstraintLayout +import com.mashup.twotoo.presenter.R +import com.mashup.twotoo.presenter.designsystem.component.TwoTooImageView import com.mashup.twotoo.presenter.designsystem.theme.TwoTooTheme -import com.mashup.twotoo.presenter.home.model.Flower import com.mashup.twotoo.presenter.home.model.HomeFlowerUiModel @Composable fun HomeFlowerLanguage( homeFlowerUiModel: HomeFlowerUiModel, modifier: Modifier = Modifier, + onClickFlowerTextBubble: (HomeFlowerUiModel) -> Unit = {}, ) { - val context = LocalContext.current - Column( - modifier = modifier, - horizontalAlignment = Alignment.CenterHorizontally, + val screenHeight = LocalConfiguration.current.screenHeightDp + val screenWidth = LocalConfiguration.current.screenWidthDp + val bubbleWidth = 92.dp * screenWidth / 375 + val bubbleHeight = 48.dp * screenHeight / 812 + val areaMargin = 10.dp * screenHeight / 812 + val bottomMargin = 12.dp * screenHeight / 812 + + ConstraintLayout( + modifier = modifier.clickable { + onClickFlowerTextBubble(homeFlowerUiModel) + }, ) { - Text( - modifier = Modifier.padding(top = 16.dp, bottom = 8.dp), - text = (homeFlowerUiModel.flowerType as Flower).getFlowerName(context = context), - style = TwoTooTheme.typography.headLineNormal24, - color = TwoTooTheme.color.mainBrown, - ) - Text( - text = homeFlowerUiModel.flowerType.getFlowerLanguage(context = context), - style = TwoTooTheme.typography.bodyNormal14, - color = TwoTooTheme.color.mainBrown, - textAlign = TextAlign.Center, - maxLines = 2, + val (bubbleWrapper, textRow) = createRefs() + TwoTooImageView( + modifier = Modifier.width(bubbleWidth).height(bubbleHeight).constrainAs(bubbleWrapper) { + start.linkTo(parent.start) + end.linkTo(parent.end) + top.linkTo(parent.top) + bottom.linkTo(parent.bottom) + }, + model = R.drawable.ic_flower_text_bubble_wrapper, + previewPlaceholder = R.drawable.ic_flower_text_bubble_wrapper, + contentScale = ContentScale.Fit, ) + Row( + modifier = Modifier.padding( + start = areaMargin, + end = areaMargin, + top = areaMargin, + bottom = areaMargin + bottomMargin, + ).constrainAs(textRow) { + start.linkTo(parent.start) + end.linkTo(parent.end) + bottom.linkTo(parent.bottom) + top.linkTo(parent.top) + }, + horizontalArrangement = Arrangement.spacedBy(4.dp), + verticalAlignment = Alignment.CenterVertically, + ) { + Text( + text = stringResource(id = R.string.homeCompleteFlowerBubbleText), + ) + TwoTooImageView( + modifier = Modifier.size(18.dp), + model = R.drawable.ic_flower_text_bubble_textflower, + previewPlaceholder = R.drawable.ic_flower_text_bubble_textflower, + ) + } } } @@ -44,6 +84,9 @@ fun HomeFlowerLanguage( @Composable private fun PreviewHomeFlowerLanguage() { TwoTooTheme { - HomeFlowerLanguage(homeFlowerUiModel = HomeFlowerUiModel.default) + HomeFlowerLanguage( + modifier = Modifier.width(92.dp).height(48.dp), + homeFlowerUiModel = HomeFlowerUiModel.default, + ) } } From 5793e1b9a0b13625570a00e276a29a6e7a7bad9a Mon Sep 17 00:00:00 2001 From: Hyunkuk Date: Mon, 2 Oct 2023 18:36:50 +0900 Subject: [PATCH 6/9] =?UTF-8?q?[feat]=20=EA=BD=83=EB=A7=90=20=ED=99=95?= =?UTF-8?q?=EC=9D=B8=20=EB=9E=8C=EB=8B=A4=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/mashup/twotoo/presenter/home/Home.kt | 6 ++++ .../home/ongoing/HomeOngoingChallenge.kt | 36 +++++++++++++++++++ .../home/ongoing/components/HomeFlower.kt | 3 ++ 3 files changed, 45 insertions(+) diff --git a/presenter/src/main/java/com/mashup/twotoo/presenter/home/Home.kt b/presenter/src/main/java/com/mashup/twotoo/presenter/home/Home.kt index d552e952..3135a7ec 100644 --- a/presenter/src/main/java/com/mashup/twotoo/presenter/home/Home.kt +++ b/presenter/src/main/java/com/mashup/twotoo/presenter/home/Home.kt @@ -37,6 +37,7 @@ import com.mashup.twotoo.presenter.home.before.HomeBeforeChallenge import com.mashup.twotoo.presenter.home.model.BeforeChallengeState import com.mashup.twotoo.presenter.home.model.BeforeChallengeUiModel import com.mashup.twotoo.presenter.home.model.HomeChallengeInfoModel +import com.mashup.twotoo.presenter.home.model.HomeFlowerUiModel import com.mashup.twotoo.presenter.home.model.HomeGoalAchievePartnerAndMeUiModel import com.mashup.twotoo.presenter.home.model.HomeStateUiModel import com.mashup.twotoo.presenter.home.model.OngoingChallengeUiModel @@ -97,6 +98,9 @@ fun HomeRoute( onClickCheerButton = homeViewModel::openToCheerBottomSheet, navigateToGuide = navigateToGuide, onWiggleAnimationEnd = homeViewModel::onWiggleAnimationEnd, + onClickFlowerTextBubble = { + // Todo 전달되는 HomeFlowerUiModel로 dialog 표시 + }, ) with(homeSideEffectHandler) { @@ -135,6 +139,7 @@ fun HomeScreen( onClickCheerButton: () -> Unit = {}, navigateToGuide: () -> Unit, onWiggleAnimationEnd: () -> Unit = {}, + onClickFlowerTextBubble: (HomeFlowerUiModel) -> Unit = {}, ) { Column(modifier = modifier) { TwoTooMainToolbar( @@ -203,6 +208,7 @@ fun HomeScreen( onCompleteButtonClick = onClickCompleteButton, onClickCheerButton = onClickCheerButton, onWiggleAnimationEnd = onWiggleAnimationEnd, + onClickFlowerTextBubble = onClickFlowerTextBubble, ) } } diff --git a/presenter/src/main/java/com/mashup/twotoo/presenter/home/ongoing/HomeOngoingChallenge.kt b/presenter/src/main/java/com/mashup/twotoo/presenter/home/ongoing/HomeOngoingChallenge.kt index 043df4aa..00f156a4 100644 --- a/presenter/src/main/java/com/mashup/twotoo/presenter/home/ongoing/HomeOngoingChallenge.kt +++ b/presenter/src/main/java/com/mashup/twotoo/presenter/home/ongoing/HomeOngoingChallenge.kt @@ -24,15 +24,20 @@ import com.mashup.twotoo.presenter.designsystem.component.button.TwoTooTextButto import com.mashup.twotoo.presenter.designsystem.theme.TwoTooTheme import com.mashup.twotoo.presenter.home.TwoTooGoalAchievementProgressbar import com.mashup.twotoo.presenter.home.model.ChallengeState +import com.mashup.twotoo.presenter.home.model.Flower import com.mashup.twotoo.presenter.home.model.HomeChallengeStateUiModel import com.mashup.twotoo.presenter.home.model.HomeCheerUiModel import com.mashup.twotoo.presenter.home.model.HomeFlowerPartnerAndMeUiModel +import com.mashup.twotoo.presenter.home.model.HomeFlowerUiModel import com.mashup.twotoo.presenter.home.model.OngoingChallengeUiModel +import com.mashup.twotoo.presenter.home.model.UserType import com.mashup.twotoo.presenter.home.ongoing.components.HomeBeeButton import com.mashup.twotoo.presenter.home.ongoing.components.HomeFlowerMeAndPartner import com.mashup.twotoo.presenter.home.ongoing.components.HomeGoalCount import com.mashup.twotoo.presenter.home.ongoing.components.HomeGoalField import com.mashup.twotoo.presenter.home.ongoing.components.HomeShotCountText +import com.mashup.twotoo.presenter.model.FlowerName +import com.mashup.twotoo.presenter.model.Stage import com.mashup.twotoo.presenter.util.wiggle /** @@ -49,6 +54,7 @@ fun HomeOngoingChallenge( navigateToHistory: (Int) -> Unit = {}, onClickCheerButton: () -> Unit = {}, onWiggleAnimationEnd: () -> Unit = {}, + onClickFlowerTextBubble: (HomeFlowerUiModel) -> Unit = {}, ) { ConstraintLayout(modifier = modifier.fillMaxSize()) { val ( @@ -96,6 +102,7 @@ fun HomeOngoingChallenge( onCommit = onCommit, homeChallengeStateUiModel = ongoingChallengeUiModel.homeChallengeStateUiModel, onClickCheerButton = onClickCheerButton, + onClickFlowerTextBubble = onClickFlowerTextBubble, ) if (ongoingChallengeUiModel.homeChallengeStateUiModel.challengeState == ChallengeState.Complete) { @@ -299,3 +306,32 @@ private fun PreviewCheerBothChallenge() { ) } } + +@Preview(showBackground = true) +@Composable +private fun PreviewCompleteBothChallenge() { + TwoTooTheme { + HomeOngoingChallenge( + ongoingChallengeUiModel = OngoingChallengeUiModel.default.copy( + homeChallengeStateUiModel = HomeChallengeStateUiModel.complete.copy( + challengeStateUiModel = HomeFlowerPartnerAndMeUiModel.authBoth.copy( + partner = HomeFlowerUiModel.partner.copy( + flowerType = Flower( + flowerName = FlowerName.Tulip, + userType = UserType.PARTNER, + growType = Stage.Fifth, + ), + ), + me = HomeFlowerUiModel.me.copy( + flowerType = Flower( + flowerName = FlowerName.Tulip, + userType = UserType.ME, + growType = Stage.Fifth, + ), + ), + ), + ), + ), + ) + } +} diff --git a/presenter/src/main/java/com/mashup/twotoo/presenter/home/ongoing/components/HomeFlower.kt b/presenter/src/main/java/com/mashup/twotoo/presenter/home/ongoing/components/HomeFlower.kt index bd139349..cf5a4346 100644 --- a/presenter/src/main/java/com/mashup/twotoo/presenter/home/ongoing/components/HomeFlower.kt +++ b/presenter/src/main/java/com/mashup/twotoo/presenter/home/ongoing/components/HomeFlower.kt @@ -57,6 +57,7 @@ fun HomeFlowerMeAndPartner( modifier: Modifier = Modifier, onCommit: () -> Unit = {}, onClickCheerButton: () -> Unit = {}, + onClickFlowerTextBubble: (HomeFlowerUiModel) -> Unit = {}, ) { ConstraintLayout( modifier = modifier, @@ -83,6 +84,7 @@ fun HomeFlowerMeAndPartner( end.linkTo(partner.end) }, homeFlowerUiModel = this.partner, + onClickFlowerTextBubble = onClickFlowerTextBubble, ) } @@ -94,6 +96,7 @@ fun HomeFlowerMeAndPartner( end.linkTo(me.end) }, homeFlowerUiModel = this.me, + onClickFlowerTextBubble = onClickFlowerTextBubble, ) } } From ff2086aa5201243f325c5026f700ff2e4c7936ab Mon Sep 17 00:00:00 2001 From: Hyunkuk Date: Mon, 2 Oct 2023 19:35:13 +0900 Subject: [PATCH 7/9] =?UTF-8?q?[feat]=20=EC=84=B1=EA=B3=B5=ED=96=88?= =?UTF-8?q?=EC=9D=84=EB=95=8C=20=EC=95=88=ED=96=88=EC=9D=84=EB=95=8C=20?= =?UTF-8?q?=ED=85=8D=EC=8A=A4=ED=8A=B8=20=EC=9D=B4=EB=AF=B8=EC=A7=80=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/res/drawable/ic_cheer_bubble_wrapper.xml | 12 ++++++++++++ presenter/src/main/res/values/string.xml | 3 ++- 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 presenter/src/main/res/drawable/ic_cheer_bubble_wrapper.xml diff --git a/presenter/src/main/res/drawable/ic_cheer_bubble_wrapper.xml b/presenter/src/main/res/drawable/ic_cheer_bubble_wrapper.xml new file mode 100644 index 00000000..3fed67cf --- /dev/null +++ b/presenter/src/main/res/drawable/ic_cheer_bubble_wrapper.xml @@ -0,0 +1,12 @@ + + + + diff --git a/presenter/src/main/res/values/string.xml b/presenter/src/main/res/values/string.xml index 2d809a4b..7672c04e 100644 --- a/presenter/src/main/res/values/string.xml +++ b/presenter/src/main/res/values/string.xml @@ -81,7 +81,8 @@ 내 응원 전 풍선 칭찬 문구 작성하기 - 꽃말 보기 + 꽃말 보기 + 다음 챌린지는\n꽃을 피워보아요! From e113a4dede8f577b03b319f5c4275b260d9a86e5 Mon Sep 17 00:00:00 2001 From: Hyunkuk Date: Mon, 2 Oct 2023 19:36:23 +0900 Subject: [PATCH 8/9] =?UTF-8?q?[feat]=20=EA=BD=83=20=EB=B6=84=EA=B8=B0=20?= =?UTF-8?q?=EB=82=B4=EB=B6=80=EC=B2=98=EB=A6=AC,=20growType=EC=97=90=20?= =?UTF-8?q?=EB=94=B0=EB=9D=BC=20=EC=9D=B4=EB=AF=B8=EC=A7=80,=20=ED=85=8D?= =?UTF-8?q?=EC=8A=A4=ED=8A=B8=20=EB=B6=84=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../home/ongoing/components/HomeFlower.kt | 40 ++++++++--------- .../ongoing/components/HomeFlowerLanguage.kt | 44 +++++++++++++------ 2 files changed, 49 insertions(+), 35 deletions(-) diff --git a/presenter/src/main/java/com/mashup/twotoo/presenter/home/ongoing/components/HomeFlower.kt b/presenter/src/main/java/com/mashup/twotoo/presenter/home/ongoing/components/HomeFlower.kt index cf5a4346..0fbf6f0c 100644 --- a/presenter/src/main/java/com/mashup/twotoo/presenter/home/ongoing/components/HomeFlower.kt +++ b/presenter/src/main/java/com/mashup/twotoo/presenter/home/ongoing/components/HomeFlower.kt @@ -76,29 +76,25 @@ fun HomeFlowerMeAndPartner( when (homeChallengeStateUiModel.challengeStateUiModel) { is HomeFlowerPartnerAndMeUiModel -> with(homeChallengeStateUiModel.challengeStateUiModel) { if (homeChallengeStateUiModel.challengeState == Complete) { - if ((this.partner.flowerType as Flower).growType >= Stage.Fourth) { - HomeFlowerLanguage( - modifier = Modifier.constrainAs(partnerFlowerLanguage) { - bottom.linkTo(partner.top) - start.linkTo(partner.start) - end.linkTo(partner.end) - }, - homeFlowerUiModel = this.partner, - onClickFlowerTextBubble = onClickFlowerTextBubble, - ) - } + HomeFlowerLanguage( + modifier = Modifier.constrainAs(partnerFlowerLanguage) { + bottom.linkTo(partner.top) + start.linkTo(partner.start) + end.linkTo(partner.end) + }, + homeFlowerUiModel = this.partner, + onClickFlowerTextBubble = onClickFlowerTextBubble, + ) - if ((this.me.flowerType as Flower).growType >= Stage.Fourth) { - HomeFlowerLanguage( - modifier = Modifier.constrainAs(meFlowerLanguage) { - bottom.linkTo(me.top) - start.linkTo(me.start) - end.linkTo(me.end) - }, - homeFlowerUiModel = this.me, - onClickFlowerTextBubble = onClickFlowerTextBubble, - ) - } + HomeFlowerLanguage( + modifier = Modifier.constrainAs(meFlowerLanguage) { + bottom.linkTo(me.top) + start.linkTo(me.start) + end.linkTo(me.end) + }, + homeFlowerUiModel = this.me, + onClickFlowerTextBubble = onClickFlowerTextBubble, + ) } if ((this.authType == FirstCreateChallenge && homeChallengeStateUiModel.challengeState != Complete) || diff --git a/presenter/src/main/java/com/mashup/twotoo/presenter/home/ongoing/components/HomeFlowerLanguage.kt b/presenter/src/main/java/com/mashup/twotoo/presenter/home/ongoing/components/HomeFlowerLanguage.kt index b3f66fe7..b8a26b3f 100644 --- a/presenter/src/main/java/com/mashup/twotoo/presenter/home/ongoing/components/HomeFlowerLanguage.kt +++ b/presenter/src/main/java/com/mashup/twotoo/presenter/home/ongoing/components/HomeFlowerLanguage.kt @@ -13,15 +13,17 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.layout.ContentScale import androidx.compose.ui.platform.LocalConfiguration -import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.stringResource +import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import androidx.constraintlayout.compose.ConstraintLayout import com.mashup.twotoo.presenter.R import com.mashup.twotoo.presenter.designsystem.component.TwoTooImageView import com.mashup.twotoo.presenter.designsystem.theme.TwoTooTheme +import com.mashup.twotoo.presenter.home.model.Flower import com.mashup.twotoo.presenter.home.model.HomeFlowerUiModel +import com.mashup.twotoo.presenter.model.Stage @Composable fun HomeFlowerLanguage( @@ -29,10 +31,11 @@ fun HomeFlowerLanguage( modifier: Modifier = Modifier, onClickFlowerTextBubble: (HomeFlowerUiModel) -> Unit = {}, ) { + val growType = (homeFlowerUiModel.flowerType as Flower).growType val screenHeight = LocalConfiguration.current.screenHeightDp val screenWidth = LocalConfiguration.current.screenWidthDp - val bubbleWidth = 92.dp * screenWidth / 375 - val bubbleHeight = 48.dp * screenHeight / 812 + val bubbleWidth = if (growType.isSuccess()) 92.dp else 118.dp * screenWidth / 375 + val bubbleHeight = if (growType.isSuccess()) 48.dp else 63.dp * screenHeight / 812 val areaMargin = 10.dp * screenHeight / 812 val bottomMargin = 12.dp * screenHeight / 812 @@ -49,8 +52,8 @@ fun HomeFlowerLanguage( top.linkTo(parent.top) bottom.linkTo(parent.bottom) }, - model = R.drawable.ic_flower_text_bubble_wrapper, - previewPlaceholder = R.drawable.ic_flower_text_bubble_wrapper, + model = if (growType.isSuccess()) R.drawable.ic_flower_text_bubble_wrapper else R.drawable.ic_cheer_bubble_wrapper, + previewPlaceholder = if (growType.isSuccess()) R.drawable.ic_flower_text_bubble_wrapper else R.drawable.ic_cheer_bubble_wrapper, contentScale = ContentScale.Fit, ) Row( @@ -68,18 +71,33 @@ fun HomeFlowerLanguage( horizontalArrangement = Arrangement.spacedBy(4.dp), verticalAlignment = Alignment.CenterVertically, ) { - Text( - text = stringResource(id = R.string.homeCompleteFlowerBubbleText), - ) - TwoTooImageView( - modifier = Modifier.size(18.dp), - model = R.drawable.ic_flower_text_bubble_textflower, - previewPlaceholder = R.drawable.ic_flower_text_bubble_textflower, - ) + if (growType.isSuccess()) { + Text( + text = stringResource(id = R.string.homeCompleteFlowerBubbleSuccessText), + style = TwoTooTheme.typography.bodyNormal16, + color = TwoTooTheme.color.mainBrown, + ) + TwoTooImageView( + modifier = Modifier.size(18.dp), + model = R.drawable.ic_flower_text_bubble_textflower, + previewPlaceholder = R.drawable.ic_flower_text_bubble_textflower, + ) + } else { + Text( + text = stringResource(id = R.string.homeCompleteFlowerBubbleFaileText), + style = TwoTooTheme.typography.bodyNormal16, + color = TwoTooTheme.color.gray600, + textAlign = TextAlign.Center, + ) + } } } } +private fun Stage.isSuccess(): Boolean { + return this >= Stage.Fourth +} + @Preview @Composable private fun PreviewHomeFlowerLanguage() { From 60c757b6b5a12ef45e5a024284082db7f459bb89 Mon Sep 17 00:00:00 2001 From: Hyunkuk Date: Mon, 2 Oct 2023 19:36:35 +0900 Subject: [PATCH 9/9] =?UTF-8?q?[feat]=20preview=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../parameter/PreviewCompleteHomeParameterProvider.kt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/presenter/src/main/java/com/mashup/twotoo/presenter/home/preview/parameter/PreviewCompleteHomeParameterProvider.kt b/presenter/src/main/java/com/mashup/twotoo/presenter/home/preview/parameter/PreviewCompleteHomeParameterProvider.kt index 94ced307..c2ea7cec 100644 --- a/presenter/src/main/java/com/mashup/twotoo/presenter/home/preview/parameter/PreviewCompleteHomeParameterProvider.kt +++ b/presenter/src/main/java/com/mashup/twotoo/presenter/home/preview/parameter/PreviewCompleteHomeParameterProvider.kt @@ -15,6 +15,7 @@ import com.mashup.twotoo.presenter.model.Stage class PreviewCompleteHomeParameterProvider : PreviewParameterProvider { override val values = listOf( completeZeroStageChallenge, + completeZeroFifthStageChallenge, completeFirstStageChallenge, completeSecondStageChallenge, completeThirdStageChallenge, @@ -34,6 +35,10 @@ class PreviewCompleteHomeParameterProvider : PreviewParameterProvider