From 06f12c65432f98683061eeaa05f2c8a7a928f329 Mon Sep 17 00:00:00 2001 From: boiledegg Date: Wed, 10 Jul 2024 19:28:29 +0900 Subject: [PATCH 01/24] =?UTF-8?q?[CHORE/#37]=20=EC=8A=A4=ED=81=AC=EB=9E=A9?= =?UTF-8?q?=20=ED=81=B4=EB=9E=98=EC=8A=A4=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../terning/feature/calendar/CalendarScrap.kt | 1 - .../feature/calendar/CalendarViewModel.kt | 18 +++++++++--------- .../terning/feature/calendar/models/Scrap.kt | 6 +++++- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/feature/src/main/java/com/terning/feature/calendar/CalendarScrap.kt b/feature/src/main/java/com/terning/feature/calendar/CalendarScrap.kt index a28d47c19..0a11f77c4 100644 --- a/feature/src/main/java/com/terning/feature/calendar/CalendarScrap.kt +++ b/feature/src/main/java/com/terning/feature/calendar/CalendarScrap.kt @@ -47,7 +47,6 @@ fun CalendarScrap( ) } } - } } diff --git a/feature/src/main/java/com/terning/feature/calendar/CalendarViewModel.kt b/feature/src/main/java/com/terning/feature/calendar/CalendarViewModel.kt index 6a286807b..fc7ebfe60 100644 --- a/feature/src/main/java/com/terning/feature/calendar/CalendarViewModel.kt +++ b/feature/src/main/java/com/terning/feature/calendar/CalendarViewModel.kt @@ -65,7 +65,7 @@ class CalendarViewModel @Inject constructor( list.add( i, listOf( - Scrap("Task1_1", CalBlue1), + Scrap("Task1_1", CalBlue1, dDay = "1", period = "3", isScraped = true), ) ) } @@ -74,8 +74,8 @@ class CalendarViewModel @Inject constructor( list.add( i, listOf( - Scrap("Task2_1", CalPink), - Scrap("Task2_2", CalGreen1) + Scrap("Task2_1", CalPink, dDay = "2", period = "3", isScraped = true), + Scrap("Task2_2", CalGreen1, dDay = "2", period = "3", isScraped = true) ) ) } @@ -98,12 +98,12 @@ class CalendarViewModel @Inject constructor( list.add( i, listOf( - Scrap("Task3_1", CalPink), - Scrap("Task3_2", CalPurple), - Scrap("Task3_3", CalRed), - Scrap("Task3_4", CalBlue1), - Scrap("Task3_5", CalGreen2), - Scrap("Task3_6", CalYellow) + Scrap("Task3_1", CalPink, dDay = "5", period = "3", isScraped = true), + Scrap("Task3_2", CalPurple, dDay = "5", period = "3", isScraped = true), + Scrap("Task3_3", CalRed, dDay = "5", period = "3", isScraped = true), + Scrap("Task3_4", CalBlue1, dDay = "5", period = "3", isScraped = true), + Scrap("Task3_5", CalGreen2, dDay = "5", period = "3", isScraped = true), + Scrap("Task3_6", CalYellow, dDay = "5", period = "3", isScraped = true) ) ) } diff --git a/feature/src/main/java/com/terning/feature/calendar/models/Scrap.kt b/feature/src/main/java/com/terning/feature/calendar/models/Scrap.kt index 73698591a..86d00350e 100644 --- a/feature/src/main/java/com/terning/feature/calendar/models/Scrap.kt +++ b/feature/src/main/java/com/terning/feature/calendar/models/Scrap.kt @@ -6,5 +6,9 @@ import androidx.compose.ui.graphics.Color @Immutable data class Scrap( val text: String, - val backgroundColor: Color + val backgroundColor: Color, + val dDay: String, + val period: String, + val isScraped: Boolean = true, + val image: String? = null ) From d5b689ebc1c319057353f796ec2d9cf4910696a7 Mon Sep 17 00:00:00 2001 From: boiledegg Date: Wed, 10 Jul 2024 19:34:31 +0900 Subject: [PATCH 02/24] =?UTF-8?q?[RENAME/#37]=20=EC=8A=A4=ED=81=AC?= =?UTF-8?q?=EB=9E=A9=20=EB=9D=A0=20=EC=9D=B4=EB=A6=84=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/terning/feature/calendar/CalendarMonth.kt | 2 +- .../calendar/{CalendarScrap.kt => CalendarScrapStrip.kt} | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename feature/src/main/java/com/terning/feature/calendar/{CalendarScrap.kt => CalendarScrapStrip.kt} (98%) diff --git a/feature/src/main/java/com/terning/feature/calendar/CalendarMonth.kt b/feature/src/main/java/com/terning/feature/calendar/CalendarMonth.kt index fc9636da3..ff114f25d 100644 --- a/feature/src/main/java/com/terning/feature/calendar/CalendarMonth.kt +++ b/feature/src/main/java/com/terning/feature/calendar/CalendarMonth.kt @@ -55,7 +55,7 @@ fun CalendarMonth( ) if(!day.isOutDate) { val index = day.date.dayOfWeek.value - 1 - CalendarScrap( + CalendarScrapStrip( scrapList = scrapLists[index] ) } diff --git a/feature/src/main/java/com/terning/feature/calendar/CalendarScrap.kt b/feature/src/main/java/com/terning/feature/calendar/CalendarScrapStrip.kt similarity index 98% rename from feature/src/main/java/com/terning/feature/calendar/CalendarScrap.kt rename to feature/src/main/java/com/terning/feature/calendar/CalendarScrapStrip.kt index 0a11f77c4..bd54acada 100644 --- a/feature/src/main/java/com/terning/feature/calendar/CalendarScrap.kt +++ b/feature/src/main/java/com/terning/feature/calendar/CalendarScrapStrip.kt @@ -16,7 +16,7 @@ import com.terning.core.designsystem.theme.White import com.terning.feature.calendar.models.Scrap @Composable -fun CalendarScrap( +fun CalendarScrapStrip( modifier: Modifier = Modifier, scrapList: List ) { From db1e489b17969ec4e443580ae63fb6e84c3a2f81 Mon Sep 17 00:00:00 2001 From: boiledegg Date: Wed, 10 Jul 2024 22:06:54 +0900 Subject: [PATCH 03/24] =?UTF-8?q?[ADD/#37]=20Coil=20=EB=9D=BC=EC=9D=B4?= =?UTF-8?q?=EB=B8=8C=EB=9F=AC=EB=A6=AC=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/build.gradle.kts | 3 +++ gradle/libs.versions.toml | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/core/build.gradle.kts b/core/build.gradle.kts index 2f11ebd4d..808329ea3 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -65,4 +65,7 @@ dependencies { testImplementation(libs.junit) androidTestImplementation(libs.androidx.junit) androidTestImplementation(libs.androidx.espresso.core) + + //ThirdPartyDependencies + implementation(libs.compose.coil) } \ No newline at end of file diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 86c865a76..1606804dd 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -56,7 +56,7 @@ coroutine = "1.8.1" timber = "5.0.1" ## Coil -coil = "1.4.0" +coil = "2.4.0" ## Security securityVersion = "1.1.0-alpha06" From b75787a623cc2d68a31b308eeb6351b6abd76bad Mon Sep 17 00:00:00 2001 From: boiledegg Date: Wed, 10 Jul 2024 22:11:21 +0900 Subject: [PATCH 04/24] =?UTF-8?q?[MOVE/#37]=20=EC=8A=A4=ED=81=AC=EB=9E=A9?= =?UTF-8?q?=20=EB=B0=95=EC=8A=A4=20=EB=B0=8F=20=EA=B3=B5=EA=B3=A0=20?= =?UTF-8?q?=EC=A0=95=EB=B3=B4=EB=B7=B0=20=EC=9C=84=EC=B9=98=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../designsystem/component/item/InternItem.kt | 103 ++++++++++++++++++ .../component/{box => item}/ScrapBox.kt | 4 +- .../terning/feature/calendar/CalendarScrap.kt | 51 +++++++++ .../feature/calendar/CalendarWeekWithScrap.kt | 15 ++- 4 files changed, 166 insertions(+), 7 deletions(-) create mode 100644 core/src/main/java/com/terning/core/designsystem/component/item/InternItem.kt rename core/src/main/java/com/terning/core/designsystem/component/{box => item}/ScrapBox.kt (95%) create mode 100644 feature/src/main/java/com/terning/feature/calendar/CalendarScrap.kt diff --git a/core/src/main/java/com/terning/core/designsystem/component/item/InternItem.kt b/core/src/main/java/com/terning/core/designsystem/component/item/InternItem.kt new file mode 100644 index 000000000..a6e8b41a3 --- /dev/null +++ b/core/src/main/java/com/terning/core/designsystem/component/item/InternItem.kt @@ -0,0 +1,103 @@ +package com.terning.core.designsystem.component.item + +import androidx.compose.foundation.Image +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.aspectRatio +import androidx.compose.foundation.layout.fillMaxHeight +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.filled.* +import androidx.compose.material.icons.outlined.Star +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.draw.clip +import androidx.compose.ui.platform.LocalContext +import androidx.compose.ui.unit.dp +import coil.compose.AsyncImage +import coil.request.ImageRequest +import com.terning.core.designsystem.theme.Black +import com.terning.core.designsystem.theme.Grey400 +import com.terning.core.designsystem.theme.TerningMain +import com.terning.core.designsystem.theme.TerningTheme + +@Composable +fun InternItem( + imageUrl: String, + title: String, + dateDeadline: String, + workingPeriod: String, + isScraped: Boolean, + modifier: Modifier = Modifier, +) { + Row( + modifier = modifier.fillMaxSize() + ) { + AsyncImage( + model = ImageRequest.Builder(LocalContext.current) + .data(imageUrl) + .build(), + contentDescription = title, + modifier + .fillMaxHeight() + .aspectRatio(1f) + .padding(vertical = 10.dp) + .clip(RoundedCornerShape(5.dp)) + ) + Column( + modifier + .padding( + top = 10.dp, + bottom = 9.dp, + start = 8.dp + ) + .weight(1f), + ) { + Text( + text = "D-" + dateDeadline, + style = TerningTheme.typography.detail0, + color = TerningMain, + ) + + Text( + text = title, + style = TerningTheme.typography.title5, + color = Black, + softWrap = true, + modifier = modifier.padding(top = 3.dp), + ) + + Row( + modifier = modifier + .padding(top = 10.dp) + ) { + Text( + text = "근무기간", + style = TerningTheme.typography.detail3, + color = Grey400 + ) + + Text( + text = workingPeriod, + style = TerningTheme.typography.detail3, + color = TerningMain, + modifier = modifier.padding(start = 4.dp) + ) + } + } + Image( + imageVector = if(isScraped) + Icons.Filled.Star + else + Icons.Outlined.Star, + contentDescription = "scrap", + modifier = modifier + .padding(end = 2.dp, bottom = 8.dp) + .align(Alignment.Bottom), + ) + } +} \ No newline at end of file diff --git a/core/src/main/java/com/terning/core/designsystem/component/box/ScrapBox.kt b/core/src/main/java/com/terning/core/designsystem/component/item/ScrapBox.kt similarity index 95% rename from core/src/main/java/com/terning/core/designsystem/component/box/ScrapBox.kt rename to core/src/main/java/com/terning/core/designsystem/component/item/ScrapBox.kt index 03c6eb7f7..a2f26072a 100644 --- a/core/src/main/java/com/terning/core/designsystem/component/box/ScrapBox.kt +++ b/core/src/main/java/com/terning/core/designsystem/component/item/ScrapBox.kt @@ -1,10 +1,8 @@ -package com.terning.core.designsystem.component.box +package com.terning.core.designsystem.component.item import androidx.compose.foundation.background import androidx.compose.foundation.border import androidx.compose.foundation.layout.Box -import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height diff --git a/feature/src/main/java/com/terning/feature/calendar/CalendarScrap.kt b/feature/src/main/java/com/terning/feature/calendar/CalendarScrap.kt new file mode 100644 index 000000000..9810f8bbb --- /dev/null +++ b/feature/src/main/java/com/terning/feature/calendar/CalendarScrap.kt @@ -0,0 +1,51 @@ +package com.terning.feature.calendar + +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.height +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.dp +import com.terning.core.designsystem.component.item.InternItem +import com.terning.core.designsystem.component.item.ScrapBox +import com.terning.core.designsystem.theme.CalBlue1 +import com.terning.core.designsystem.theme.TerningPointTheme +import com.terning.feature.calendar.models.Scrap + +@Composable +fun CalendarScrap( + modifier: Modifier = Modifier, + scrap: Scrap +) { + ScrapBox( + cornerRadius = 10.dp, + scrapColor = scrap.backgroundColor, + modifier = modifier + .height(height = 92.dp) + .fillMaxWidth(), + ) { + InternItem( + imageUrl = scrap.image.orEmpty(), + title = scrap.text, + dateDeadline = scrap.dDay, + workingPeriod = scrap.period, + isScraped = scrap.isScraped + ) + } +} + +@Preview(showBackground = true) +@Composable +fun CalendarScrapPreview() { + TerningPointTheme { + CalendarScrap( + scrap = Scrap( + text = "Task1_1", + backgroundColor = CalBlue1, + dDay = "1", + period = "3", + isScraped = true + ) + ) + } +} \ No newline at end of file diff --git a/feature/src/main/java/com/terning/feature/calendar/CalendarWeekWithScrap.kt b/feature/src/main/java/com/terning/feature/calendar/CalendarWeekWithScrap.kt index fbdf774cc..c5799bb34 100644 --- a/feature/src/main/java/com/terning/feature/calendar/CalendarWeekWithScrap.kt +++ b/feature/src/main/java/com/terning/feature/calendar/CalendarWeekWithScrap.kt @@ -5,8 +5,10 @@ import androidx.compose.foundation.border import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.lazy.LazyColumn +import androidx.compose.foundation.lazy.items import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material3.Card +import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.draw.shadow @@ -49,14 +51,19 @@ fun CalendarWeekWithScrap( ) } + Text( + text = LocalDate.now().toString() + ) + LazyColumn( modifier = Modifier .fillMaxWidth() ) { - /*items(items = scrapLists[selectedDate?.dayOfMonth - 1]) { - - }*/ - + items(items = scrapLists[selectedDate.selectedDate.dayOfMonth - 1]) { scrap -> + CalendarScrap( + scrap = scrap + ) + } } } From ea21f7cffea4953ef451cc7b1f1ae7f002308b09 Mon Sep 17 00:00:00 2001 From: boiledegg Date: Wed, 10 Jul 2024 22:40:34 +0900 Subject: [PATCH 05/24] =?UTF-8?q?[CHORE/#37]=20=EC=98=A4=EB=A5=98=20?= =?UTF-8?q?=EB=A1=9C=EC=A7=81=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/terning/feature/calendar/CalendarMonth.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/feature/src/main/java/com/terning/feature/calendar/CalendarMonth.kt b/feature/src/main/java/com/terning/feature/calendar/CalendarMonth.kt index ff114f25d..3b2cdf6e7 100644 --- a/feature/src/main/java/com/terning/feature/calendar/CalendarMonth.kt +++ b/feature/src/main/java/com/terning/feature/calendar/CalendarMonth.kt @@ -54,7 +54,7 @@ fun CalendarMonth( onDateSelected = onDateSelected ) if(!day.isOutDate) { - val index = day.date.dayOfWeek.value - 1 + val index = day.date.dayOfMonth - 1 CalendarScrapStrip( scrapList = scrapLists[index] ) From efe9edd2fa53087ed5681860eadd63273a3d6dc4 Mon Sep 17 00:00:00 2001 From: boiledegg Date: Thu, 11 Jul 2024 01:24:52 +0900 Subject: [PATCH 06/24] =?UTF-8?q?[FEAT/#37]=20LocalDate=20=ED=99=95?= =?UTF-8?q?=EC=9E=A5=ED=95=A8=EC=88=98=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/terning/core/extension/LocalDateExt.kt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/src/main/java/com/terning/core/extension/LocalDateExt.kt b/core/src/main/java/com/terning/core/extension/LocalDateExt.kt index ee8c97476..31d49e9ce 100644 --- a/core/src/main/java/com/terning/core/extension/LocalDateExt.kt +++ b/core/src/main/java/com/terning/core/extension/LocalDateExt.kt @@ -1,10 +1,15 @@ package com.terning.core.extension import java.time.LocalDate +import java.time.format.TextStyle +import java.util.Locale fun LocalDate.getStringAsTitle(): String = "${year}년 ${monthValue.toString().padStart(2, '0')}월" +fun LocalDate.getDateStringInKorean(): String = + "${monthValue}월 ${dayOfMonth}일 ${dayOfWeek.getDisplayName(TextStyle.FULL, Locale.KOREAN)}" + fun LocalDate.getWeekIndexContainingSelectedDate(): Int = dayOfMonth / 7 fun LocalDate.isToday(): Boolean = this == LocalDate.now() \ No newline at end of file From 361d2f12992f1b9bd4ea313971930428ce460b00 Mon Sep 17 00:00:00 2001 From: boiledegg Date: Thu, 11 Jul 2024 03:49:50 +0900 Subject: [PATCH 07/24] =?UTF-8?q?[ADD/#37]=20=EC=8A=A4=ED=81=AC=EB=9E=A9?= =?UTF-8?q?=20=EC=9D=B4=EB=AF=B8=EC=A7=80=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/src/main/res/drawable/ic_bookmark_filled.xml | 13 +++++++++++++ core/src/main/res/drawable/ic_bookmark_outlined.xml | 13 +++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 core/src/main/res/drawable/ic_bookmark_filled.xml create mode 100644 core/src/main/res/drawable/ic_bookmark_outlined.xml diff --git a/core/src/main/res/drawable/ic_bookmark_filled.xml b/core/src/main/res/drawable/ic_bookmark_filled.xml new file mode 100644 index 000000000..0b884f362 --- /dev/null +++ b/core/src/main/res/drawable/ic_bookmark_filled.xml @@ -0,0 +1,13 @@ + + + diff --git a/core/src/main/res/drawable/ic_bookmark_outlined.xml b/core/src/main/res/drawable/ic_bookmark_outlined.xml new file mode 100644 index 000000000..ed8cf9471 --- /dev/null +++ b/core/src/main/res/drawable/ic_bookmark_outlined.xml @@ -0,0 +1,13 @@ + + + From 2d24fa79306a1547404142c8fd391555187b76f0 Mon Sep 17 00:00:00 2001 From: boiledegg Date: Thu, 11 Jul 2024 03:50:45 +0900 Subject: [PATCH 08/24] =?UTF-8?q?[UI/#37]=20=EA=B3=B5=EA=B3=A0=20=EB=AA=A9?= =?UTF-8?q?=EB=A1=9D=20=EC=BB=B4=ED=8F=AC=EB=84=8C=ED=8A=B8=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../designsystem/component/item/InternItem.kt | 98 ++++++++++++++----- core/src/main/res/values/strings.xml | 6 ++ 2 files changed, 78 insertions(+), 26 deletions(-) diff --git a/core/src/main/java/com/terning/core/designsystem/component/item/InternItem.kt b/core/src/main/java/com/terning/core/designsystem/component/item/InternItem.kt index a6e8b41a3..8bfab6919 100644 --- a/core/src/main/java/com/terning/core/designsystem/component/item/InternItem.kt +++ b/core/src/main/java/com/terning/core/designsystem/component/item/InternItem.kt @@ -1,12 +1,19 @@ package com.terning.core.designsystem.component.item import androidx.compose.foundation.Image +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.aspectRatio import androidx.compose.foundation.layout.fillMaxHeight import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.width import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.* @@ -17,13 +24,24 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip import androidx.compose.ui.platform.LocalContext +import androidx.compose.ui.res.painterResource +import androidx.compose.ui.res.stringResource +import androidx.compose.ui.text.SpanStyle +import androidx.compose.ui.text.buildAnnotatedString +import androidx.compose.ui.text.withStyle +import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp +import androidx.core.text.buildSpannedString import coil.compose.AsyncImage import coil.request.ImageRequest +import com.terning.core.R import com.terning.core.designsystem.theme.Black +import com.terning.core.designsystem.theme.Grey300 import com.terning.core.designsystem.theme.Grey400 import com.terning.core.designsystem.theme.TerningMain +import com.terning.core.designsystem.theme.TerningPointTheme import com.terning.core.designsystem.theme.TerningTheme +import com.terning.core.extension.noRippleClickable @Composable fun InternItem( @@ -33,32 +51,31 @@ fun InternItem( workingPeriod: String, isScraped: Boolean, modifier: Modifier = Modifier, + onScrapButtonClicked: () -> Unit = {}, ) { Row( - modifier = modifier.fillMaxSize() + modifier = modifier + .padding(10.dp) + .fillMaxSize(), ) { AsyncImage( model = ImageRequest.Builder(LocalContext.current) .data(imageUrl) .build(), contentDescription = title, - modifier + Modifier .fillMaxHeight() .aspectRatio(1f) - .padding(vertical = 10.dp) .clip(RoundedCornerShape(5.dp)) + .background(color = Grey300) ) Column( - modifier - .padding( - top = 10.dp, - bottom = 9.dp, - start = 8.dp - ) - .weight(1f), + modifier = Modifier + .padding(start = 8.dp) + .fillMaxHeight() ) { Text( - text = "D-" + dateDeadline, + text = stringResource(id = R.string.intern_item_d_day, dateDeadline), style = TerningTheme.typography.detail0, color = TerningMain, ) @@ -72,32 +89,61 @@ fun InternItem( ) Row( - modifier = modifier - .padding(top = 10.dp) + modifier = Modifier.fillMaxHeight(), + verticalAlignment = Alignment.Bottom ) { Text( - text = "근무기간", + text = stringResource(R.string.intern_item_working_period), style = TerningTheme.typography.detail3, color = Grey400 ) Text( - text = workingPeriod, + text = stringResource(id = R.string.intern_item_working_period_month, workingPeriod), style = TerningTheme.typography.detail3, color = TerningMain, - modifier = modifier.padding(start = 4.dp) + modifier = modifier + .padding(start = 4.dp) ) } } - Image( - imageVector = if(isScraped) - Icons.Filled.Star - else - Icons.Outlined.Star, - contentDescription = "scrap", - modifier = modifier - .padding(end = 2.dp, bottom = 8.dp) - .align(Alignment.Bottom), - ) + + Box(modifier = Modifier.fillMaxSize()) { + Image( + painter = painterResource( + id = + if (isScraped) + R.drawable.ic_bookmark_filled + else + R.drawable.ic_bookmark_outlined + ), + contentDescription = stringResource(id = R.string.intern_item_scrap), + modifier = modifier + .align(Alignment.BottomEnd) + .noRippleClickable { + onScrapButtonClicked() + }, + ) + } + } +} + +@Preview(showBackground = true) +@Composable +fun InternItemPreview() { + TerningPointTheme { + Box( + modifier = Modifier + .height(height = 92.dp) + .fillMaxWidth(), + ){ + InternItem( + imageUrl = "", + title = "test title", + dateDeadline = "3", + workingPeriod = "6", + isScraped = true + ) + } } } \ No newline at end of file diff --git a/core/src/main/res/values/strings.xml b/core/src/main/res/values/strings.xml index a60fd53c1..d8a46b213 100644 --- a/core/src/main/res/values/strings.xml +++ b/core/src/main/res/values/strings.xml @@ -11,4 +11,10 @@ button + + 근무기간 + %s개월 + D-%s + 스크랩 + \ No newline at end of file From 99513357e2fe8b5c30309bb40082369e1d04f106 Mon Sep 17 00:00:00 2001 From: boiledegg Date: Thu, 11 Jul 2024 03:54:21 +0900 Subject: [PATCH 09/24] =?UTF-8?q?[UI/#37]=20=EC=A3=BC=EA=B0=84=20=EC=BA=98?= =?UTF-8?q?=EB=A6=B0=EB=8D=94=20=EC=8A=A4=ED=81=AC=EB=9E=A9=20=EB=AA=A9?= =?UTF-8?q?=EB=A1=9D=20=ED=99=94=EB=A9=B4=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../feature/calendar/CalendarWeekWithScrap.kt | 55 +++++++++++++++---- 1 file changed, 44 insertions(+), 11 deletions(-) diff --git a/feature/src/main/java/com/terning/feature/calendar/CalendarWeekWithScrap.kt b/feature/src/main/java/com/terning/feature/calendar/CalendarWeekWithScrap.kt index c5799bb34..1d177ee39 100644 --- a/feature/src/main/java/com/terning/feature/calendar/CalendarWeekWithScrap.kt +++ b/feature/src/main/java/com/terning/feature/calendar/CalendarWeekWithScrap.kt @@ -2,19 +2,30 @@ package com.terning.feature.calendar import androidx.compose.foundation.background import androidx.compose.foundation.border +import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.padding import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.items import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material3.Card import androidx.compose.material3.Text import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.shadow +import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.dp +import com.terning.core.designsystem.theme.Black import com.terning.core.designsystem.theme.Grey200 +import com.terning.core.designsystem.theme.Grey400 +import com.terning.core.designsystem.theme.TerningTheme import com.terning.core.designsystem.theme.White +import com.terning.core.extension.getDateStringInKorean import com.terning.feature.calendar.models.Scrap import com.terning.feature.calendar.models.SelectedDateState import java.time.LocalDate @@ -34,7 +45,8 @@ fun CalendarWeekWithScrap( .border( width = 0.dp, color = Grey200, - shape = RoundedCornerShape(bottomStart = 20.dp, bottomEnd = 20.dp)) + shape = RoundedCornerShape(bottomStart = 20.dp, bottomEnd = 20.dp) + ) .shadow( shape = RoundedCornerShape(bottomStart = 20.dp, bottomEnd = 20.dp), elevation = 1.dp @@ -52,19 +64,40 @@ fun CalendarWeekWithScrap( } Text( - text = LocalDate.now().toString() + text = selectedDate.selectedDate.getDateStringInKorean(), + style = TerningTheme.typography.title5, + color = Black, + modifier = Modifier.padding(start = 24.dp, top = 16.dp, bottom = 15.dp) ) - LazyColumn( - modifier = Modifier - .fillMaxWidth() - ) { - items(items = scrapLists[selectedDate.selectedDate.dayOfMonth - 1]) { scrap -> - CalendarScrap( - scrap = scrap - ) + if (scrapLists[selectedDate.selectedDate.dayOfMonth - 1].isEmpty()) { + Text( + modifier = Modifier + .padding(top = 42.dp) + .fillMaxWidth(), + text = "선택하신 날짜에 지원 마감인 스크랩 공고가 없어요.", + textAlign = TextAlign.Center, + style = TerningTheme.typography.body5, + color = Grey400 + ) + } else { + LazyColumn( + modifier = Modifier + .fillMaxWidth() + .padding(horizontal = 24.dp), + ) { + items(items = scrapLists[selectedDate.selectedDate.dayOfMonth - 1]) { scrap -> + CalendarScrap( + scrap = scrap + ) + Spacer( + modifier = Modifier.height(12.dp) + ) + } } } } +} + + -} \ No newline at end of file From 8304252f2d6df91b5709464cf1ae7fa233b1fccb Mon Sep 17 00:00:00 2001 From: boiledegg Date: Thu, 11 Jul 2024 03:54:37 +0900 Subject: [PATCH 10/24] =?UTF-8?q?[MOD/#37]=20=EA=B8=B0=ED=83=80=20?= =?UTF-8?q?=EC=BD=94=EB=93=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/terning/feature/calendar/CalendarScrap.kt | 3 ++- .../java/com/terning/feature/calendar/CalendarScrapStrip.kt | 2 +- .../src/main/java/com/terning/feature/calendar/CalendarWeek.kt | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/feature/src/main/java/com/terning/feature/calendar/CalendarScrap.kt b/feature/src/main/java/com/terning/feature/calendar/CalendarScrap.kt index 9810f8bbb..b5ea056c2 100644 --- a/feature/src/main/java/com/terning/feature/calendar/CalendarScrap.kt +++ b/feature/src/main/java/com/terning/feature/calendar/CalendarScrap.kt @@ -14,12 +14,13 @@ import com.terning.feature.calendar.models.Scrap @Composable fun CalendarScrap( + scrap: Scrap, modifier: Modifier = Modifier, - scrap: Scrap ) { ScrapBox( cornerRadius = 10.dp, scrapColor = scrap.backgroundColor, + elevation = 1.dp, modifier = modifier .height(height = 92.dp) .fillMaxWidth(), diff --git a/feature/src/main/java/com/terning/feature/calendar/CalendarScrapStrip.kt b/feature/src/main/java/com/terning/feature/calendar/CalendarScrapStrip.kt index bd54acada..a06842b05 100644 --- a/feature/src/main/java/com/terning/feature/calendar/CalendarScrapStrip.kt +++ b/feature/src/main/java/com/terning/feature/calendar/CalendarScrapStrip.kt @@ -50,5 +50,5 @@ fun CalendarScrapStrip( } } -private const val MAX_SCRAP_COUNT = 2 +private const val MAX_SCRAP_COUNT = 3 diff --git a/feature/src/main/java/com/terning/feature/calendar/CalendarWeek.kt b/feature/src/main/java/com/terning/feature/calendar/CalendarWeek.kt index 7fb0e5d43..51b21b777 100644 --- a/feature/src/main/java/com/terning/feature/calendar/CalendarWeek.kt +++ b/feature/src/main/java/com/terning/feature/calendar/CalendarWeek.kt @@ -38,7 +38,7 @@ fun CalendarWeek( LazyRow( modifier = Modifier .fillMaxWidth() - .padding(20.dp), + .padding(horizontal = 32.dp, vertical = 20.dp), horizontalArrangement = Arrangement.SpaceBetween ) { items(items = monthData.calendarMonth.weekDays[page]) { day -> From 62712b1fca1da2d50ffd6ea693393b40dcabe049 Mon Sep 17 00:00:00 2001 From: boiledegg Date: Thu, 11 Jul 2024 04:32:29 +0900 Subject: [PATCH 11/24] =?UTF-8?q?[MOD/#37]=20=EC=8A=A4=ED=81=AC=EB=9E=A9?= =?UTF-8?q?=20=EB=AA=A9=EB=A1=9D=20=EB=A1=9C=EC=A7=81=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../feature/calendar/CalendarScrapList.kt | 53 +++++++++++++++++++ .../feature/calendar/CalendarWeekWithScrap.kt | 47 +++++----------- 2 files changed, 67 insertions(+), 33 deletions(-) create mode 100644 feature/src/main/java/com/terning/feature/calendar/CalendarScrapList.kt diff --git a/feature/src/main/java/com/terning/feature/calendar/CalendarScrapList.kt b/feature/src/main/java/com/terning/feature/calendar/CalendarScrapList.kt new file mode 100644 index 000000000..c351af47c --- /dev/null +++ b/feature/src/main/java/com/terning/feature/calendar/CalendarScrapList.kt @@ -0,0 +1,53 @@ +package com.terning.feature.calendar + +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.lazy.LazyColumn +import androidx.compose.foundation.lazy.items +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.unit.dp +import com.terning.core.designsystem.theme.Back +import com.terning.core.designsystem.theme.Black +import com.terning.core.designsystem.theme.TerningTheme +import com.terning.core.extension.getDateStringInKorean +import com.terning.feature.calendar.models.Scrap +import java.time.LocalDate + +@Composable +fun CalendarScrapList( + selectedDate: LocalDate, + scrapLists: List>, + noScrapScreen: @Composable () -> Unit +) { + Text( + text = selectedDate.getDateStringInKorean(), + style = TerningTheme.typography.title5, + color = Black, + modifier = Modifier.padding(start = 24.dp, top = 16.dp, bottom = 15.dp) + ) + + if (scrapLists[selectedDate.dayOfMonth - 1].isEmpty()) { + noScrapScreen() + } else { + LazyColumn( + modifier = Modifier + .fillMaxWidth() + .padding(horizontal = 24.dp), + ) { + items(items = scrapLists[selectedDate.dayOfMonth - 1]) { scrap -> + CalendarScrap( + scrap = scrap + ) + Spacer( + modifier = Modifier.height(12.dp) + ) + } + } + } +} \ No newline at end of file diff --git a/feature/src/main/java/com/terning/feature/calendar/CalendarWeekWithScrap.kt b/feature/src/main/java/com/terning/feature/calendar/CalendarWeekWithScrap.kt index 1d177ee39..333654a55 100644 --- a/feature/src/main/java/com/terning/feature/calendar/CalendarWeekWithScrap.kt +++ b/feature/src/main/java/com/terning/feature/calendar/CalendarWeekWithScrap.kt @@ -62,40 +62,21 @@ fun CalendarWeekWithScrap( onDateSelected = onDateSelected ) } - - Text( - text = selectedDate.selectedDate.getDateStringInKorean(), - style = TerningTheme.typography.title5, - color = Black, - modifier = Modifier.padding(start = 24.dp, top = 16.dp, bottom = 15.dp) - ) - - if (scrapLists[selectedDate.selectedDate.dayOfMonth - 1].isEmpty()) { - Text( - modifier = Modifier - .padding(top = 42.dp) - .fillMaxWidth(), - text = "선택하신 날짜에 지원 마감인 스크랩 공고가 없어요.", - textAlign = TextAlign.Center, - style = TerningTheme.typography.body5, - color = Grey400 - ) - } else { - LazyColumn( - modifier = Modifier - .fillMaxWidth() - .padding(horizontal = 24.dp), - ) { - items(items = scrapLists[selectedDate.selectedDate.dayOfMonth - 1]) { scrap -> - CalendarScrap( - scrap = scrap - ) - Spacer( - modifier = Modifier.height(12.dp) - ) - } + CalendarScrapList( + selectedDate = selectedDate.selectedDate, + scrapLists = scrapLists, + noScrapScreen = { + Text( + modifier = Modifier + .padding(top = 42.dp) + .fillMaxWidth(), + text = "선택하신 날짜에 지원 마감인 스크랩 공고가 없어요.", + textAlign = TextAlign.Center, + style = TerningTheme.typography.body5, + color = Grey400 + ) } - } + ) } } From 88d4ee9dff10db2cc253da388349b7c648a17fb0 Mon Sep 17 00:00:00 2001 From: boiledegg Date: Thu, 11 Jul 2024 04:50:20 +0900 Subject: [PATCH 12/24] =?UTF-8?q?[UI/#37]=20=EC=8A=A4=ED=81=AC=EB=9E=A9=20?= =?UTF-8?q?=EB=AA=A9=EB=A1=9D=20=ED=99=94=EB=A9=B4=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../terning/feature/calendar/CalendarRoute.kt | 99 ++++++++++--------- .../feature/calendar/CalendarScrapList.kt | 55 +++++++++-- 2 files changed, 101 insertions(+), 53 deletions(-) diff --git a/feature/src/main/java/com/terning/feature/calendar/CalendarRoute.kt b/feature/src/main/java/com/terning/feature/calendar/CalendarRoute.kt index 827f8d416..cf52bac59 100644 --- a/feature/src/main/java/com/terning/feature/calendar/CalendarRoute.kt +++ b/feature/src/main/java/com/terning/feature/calendar/CalendarRoute.kt @@ -96,55 +96,64 @@ fun CalendarScreen( ) } ) { paddingValues -> - Column( - modifier = Modifier - .fillMaxSize() - .padding(top = paddingValues.calculateTopPadding()) - ) { - WeekDaysHeader() - Spacer( - modifier = Modifier - .fillMaxWidth() - .height(1.dp) - .background(color = Grey200) + if(isListExpanded){ + CalendarScrapList( + modifier = Modifier.fillMaxSize() + .padding(top = paddingValues.calculateTopPadding()), + date = currentDate, + scrapList = viewModel.mockScrapList ) + } else { + Column( + modifier = Modifier + .fillMaxSize() + .padding(top = paddingValues.calculateTopPadding()) + ) { + WeekDaysHeader() + Spacer( + modifier = Modifier + .fillMaxWidth() + .height(1.dp) + .background(color = Grey200) + ) - AnimatedContent( - targetState = selectedDate.isEnabled, - transitionSpec = { + AnimatedContent( + targetState = selectedDate.isEnabled, + transitionSpec = { + if (!targetState) { + slideInVertically { fullHeight -> -fullHeight } togetherWith + slideOutVertically { fullHeight -> fullHeight } + } else { + slideInVertically { fullHeight -> fullHeight } togetherWith + slideOutVertically { fullHeight -> -fullHeight } + }.using( + sizeTransform = SizeTransform(clip = true) + ) + }, + label = stringResource(id = R.string.calendar_animation_label) + ) { targetState -> if (!targetState) { - slideInVertically { fullHeight -> -fullHeight } togetherWith - slideOutVertically { fullHeight -> fullHeight } + CalendarMonths( + modifier = Modifier.fillMaxSize(), + selectedDate = selectedDate, + onDateSelected = { + viewModel.updateSelectedDate(it) + }, + listState = listState, + pages = state.getPageCount(), + scrapLists = viewModel.mockScrapList, + ) } else { - slideInVertically { fullHeight -> fullHeight } togetherWith - slideOutVertically { fullHeight -> -fullHeight } - }.using( - sizeTransform = SizeTransform(clip = true) - ) - }, - label = stringResource(id = R.string.calendar_animation_label) - ) { targetState -> - if (!targetState) { - CalendarMonths( - modifier = Modifier.fillMaxSize(), - selectedDate = selectedDate, - onDateSelected = { - viewModel.updateSelectedDate(it) - }, - listState = listState, - pages = state.getPageCount(), - scrapLists = viewModel.mockScrapList, - ) - } else { - CalendarWeekWithScrap( - modifier = Modifier - .fillMaxSize(), - selectedDate = selectedDate, - scrapLists = viewModel.mockScrapList, - onDateSelected = { - viewModel.updateSelectedDate(it) - } - ) + CalendarWeekWithScrap( + modifier = Modifier + .fillMaxSize(), + selectedDate = selectedDate, + scrapLists = viewModel.mockScrapList, + onDateSelected = { + viewModel.updateSelectedDate(it) + } + ) + } } } } diff --git a/feature/src/main/java/com/terning/feature/calendar/CalendarScrapList.kt b/feature/src/main/java/com/terning/feature/calendar/CalendarScrapList.kt index c351af47c..9783b06ee 100644 --- a/feature/src/main/java/com/terning/feature/calendar/CalendarScrapList.kt +++ b/feature/src/main/java/com/terning/feature/calendar/CalendarScrapList.kt @@ -1,6 +1,7 @@ package com.terning.feature.calendar import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth @@ -14,33 +15,71 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp import com.terning.core.designsystem.theme.Back import com.terning.core.designsystem.theme.Black +import com.terning.core.designsystem.theme.Grey200 import com.terning.core.designsystem.theme.TerningTheme import com.terning.core.extension.getDateStringInKorean import com.terning.feature.calendar.models.Scrap import java.time.LocalDate +@Composable +fun CalendarScrapList( + date: LocalDate, + scrapList: List>, + modifier: Modifier = Modifier +) { + LazyColumn( + modifier = modifier + .fillMaxSize() + .background(Back) + ) { + items(scrapList.size) { + val currentDate = LocalDate.of(date.year, date.monthValue, it + 1) + CalendarScrapList( + isFromListScreen = true, + selectedDate = currentDate, + scrapLists = scrapList, + noScrapScreen = {}) + + + if(scrapList[it].isNotEmpty()) { + Spacer( + modifier = Modifier + .height(4.dp) + .fillMaxWidth() + .background(Grey200) + ) + } + } + } + +} + @Composable fun CalendarScrapList( selectedDate: LocalDate, scrapLists: List>, + isFromListScreen: Boolean = false, noScrapScreen: @Composable () -> Unit ) { - Text( - text = selectedDate.getDateStringInKorean(), - style = TerningTheme.typography.title5, - color = Black, - modifier = Modifier.padding(start = 24.dp, top = 16.dp, bottom = 15.dp) - ) + if (scrapLists[selectedDate.dayOfMonth - 1].isNotEmpty()) { + Text( + text = selectedDate.getDateStringInKorean(), + style = TerningTheme.typography.title5, + color = Black, + modifier = Modifier.padding(start = 24.dp, top = 16.dp, bottom = 15.dp) + ) + } + if (scrapLists[selectedDate.dayOfMonth - 1].isEmpty()) { noScrapScreen() } else { - LazyColumn( + Column( modifier = Modifier .fillMaxWidth() .padding(horizontal = 24.dp), ) { - items(items = scrapLists[selectedDate.dayOfMonth - 1]) { scrap -> + for (scrap in scrapLists[selectedDate.dayOfMonth - 1]) { CalendarScrap( scrap = scrap ) From 6f90ba1f5b01db87619bb44698f7e610156c31be Mon Sep 17 00:00:00 2001 From: boiledegg Date: Thu, 11 Jul 2024 04:53:48 +0900 Subject: [PATCH 13/24] =?UTF-8?q?[CHORE/#37]=20=EB=A6=AC=EC=8A=A4=ED=8A=B8?= =?UTF-8?q?=20=EB=B2=84=ED=8A=BC=20=EC=83=89=EC=83=81=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/terning/feature/calendar/component/CalendarTopBar.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/feature/src/main/java/com/terning/feature/calendar/component/CalendarTopBar.kt b/feature/src/main/java/com/terning/feature/calendar/component/CalendarTopBar.kt index bdfcf8ffd..cd16a1fe1 100644 --- a/feature/src/main/java/com/terning/feature/calendar/component/CalendarTopBar.kt +++ b/feature/src/main/java/com/terning/feature/calendar/component/CalendarTopBar.kt @@ -17,6 +17,7 @@ import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import com.terning.core.designsystem.theme.Black import com.terning.core.designsystem.theme.Grey300 +import com.terning.core.designsystem.theme.TerningMain import com.terning.core.designsystem.theme.TerningPointTheme import com.terning.core.designsystem.theme.TerningTheme import com.terning.core.extension.getStringAsTitle @@ -80,7 +81,7 @@ fun CalendarTopBar( ), contentDescription = stringResource(id = R.string.calendar_button_description_list), modifier = Modifier.noRippleClickable { onListButtonClicked() }, - tint = if (isListExpanded) Color.Green else Color.LightGray, + tint = if (isListExpanded) TerningMain else Grey300, ) } } From 0b716ed10a4e216cbce1dd5edff45af7f737650e Mon Sep 17 00:00:00 2001 From: boiledegg Date: Thu, 11 Jul 2024 04:58:54 +0900 Subject: [PATCH 14/24] =?UTF-8?q?[CHORE/#37]=20=EB=A6=AC=EC=8A=A4=ED=8A=B8?= =?UTF-8?q?=20=EB=B0=B0=EA=B2=BD=EC=83=89=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/terning/feature/calendar/CalendarWeekWithScrap.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/feature/src/main/java/com/terning/feature/calendar/CalendarWeekWithScrap.kt b/feature/src/main/java/com/terning/feature/calendar/CalendarWeekWithScrap.kt index 333654a55..11f7dfcb5 100644 --- a/feature/src/main/java/com/terning/feature/calendar/CalendarWeekWithScrap.kt +++ b/feature/src/main/java/com/terning/feature/calendar/CalendarWeekWithScrap.kt @@ -20,6 +20,7 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.draw.shadow import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.dp +import com.terning.core.designsystem.theme.Back import com.terning.core.designsystem.theme.Black import com.terning.core.designsystem.theme.Grey200 import com.terning.core.designsystem.theme.Grey400 @@ -39,6 +40,7 @@ fun CalendarWeekWithScrap( ) { Column( modifier = modifier + .background(Back) ) { Card( modifier = Modifier From f2b7b6040bcf4cc188df59d30999f9d4ac77e1b0 Mon Sep 17 00:00:00 2001 From: boiledegg Date: Thu, 11 Jul 2024 06:00:52 +0900 Subject: [PATCH 15/24] =?UTF-8?q?[UI/#37]=20=EB=A6=AC=EC=8A=A4=ED=8A=B8=20?= =?UTF-8?q?=EC=A0=84=ED=99=98=20=EC=95=A0=EB=8B=88=EB=A9=94=EC=9D=B4?= =?UTF-8?q?=EC=85=98=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../terning/feature/calendar/CalendarRoute.kt | 124 ++++++++++-------- 1 file changed, 72 insertions(+), 52 deletions(-) diff --git a/feature/src/main/java/com/terning/feature/calendar/CalendarRoute.kt b/feature/src/main/java/com/terning/feature/calendar/CalendarRoute.kt index cf52bac59..238abeedd 100644 --- a/feature/src/main/java/com/terning/feature/calendar/CalendarRoute.kt +++ b/feature/src/main/java/com/terning/feature/calendar/CalendarRoute.kt @@ -3,7 +3,9 @@ package com.terning.feature.calendar import androidx.activity.compose.BackHandler import androidx.compose.animation.AnimatedContent import androidx.compose.animation.SizeTransform +import androidx.compose.animation.slideInHorizontally import androidx.compose.animation.slideInVertically +import androidx.compose.animation.slideOutHorizontally import androidx.compose.animation.slideOutVertically import androidx.compose.animation.togetherWith import androidx.compose.foundation.background @@ -96,67 +98,85 @@ fun CalendarScreen( ) } ) { paddingValues -> - if(isListExpanded){ - CalendarScrapList( - modifier = Modifier.fillMaxSize() - .padding(top = paddingValues.calculateTopPadding()), - date = currentDate, - scrapList = viewModel.mockScrapList - ) - } else { - Column( - modifier = Modifier - .fillMaxSize() - .padding(top = paddingValues.calculateTopPadding()) - ) { - WeekDaysHeader() - Spacer( + AnimatedContent( + targetState = isListExpanded, + transitionSpec = { + if (!targetState) { + slideInHorizontally { fullWidth -> -fullWidth } togetherWith + slideOutHorizontally { fullWidth -> fullWidth } + } else { + slideInHorizontally { fullWidth -> fullWidth } togetherWith + slideOutHorizontally { fullWidth -> -fullWidth } + }.using( + sizeTransform = SizeTransform(clip = true) + ) + }, + label = "List Transition" + ) { + if (it) { + CalendarScrapList( modifier = Modifier - .fillMaxWidth() - .height(1.dp) - .background(color = Grey200) + .fillMaxSize() + .padding(top = paddingValues.calculateTopPadding()), + date = currentDate, + scrapList = viewModel.mockScrapList ) + } else { + Column( + modifier = Modifier + .fillMaxSize() + .padding(top = paddingValues.calculateTopPadding()) + ) { + WeekDaysHeader() + Spacer( + modifier = Modifier + .fillMaxWidth() + .height(1.dp) + .background(color = Grey200) + ) - AnimatedContent( - targetState = selectedDate.isEnabled, - transitionSpec = { + AnimatedContent( + targetState = selectedDate.isEnabled, + transitionSpec = { + if (!targetState) { + slideInVertically { fullHeight -> -fullHeight } togetherWith + slideOutVertically { fullHeight -> fullHeight } + } else { + slideInVertically { fullHeight -> fullHeight } togetherWith + slideOutVertically { fullHeight -> -fullHeight } + }.using( + sizeTransform = SizeTransform(clip = true) + ) + }, + label = stringResource(id = R.string.calendar_animation_label) + ) { targetState -> if (!targetState) { - slideInVertically { fullHeight -> -fullHeight } togetherWith - slideOutVertically { fullHeight -> fullHeight } + CalendarMonths( + modifier = Modifier.fillMaxSize(), + selectedDate = selectedDate, + onDateSelected = { + viewModel.updateSelectedDate(it) + }, + listState = listState, + pages = state.getPageCount(), + scrapLists = viewModel.mockScrapList, + ) } else { - slideInVertically { fullHeight -> fullHeight } togetherWith - slideOutVertically { fullHeight -> -fullHeight } - }.using( - sizeTransform = SizeTransform(clip = true) - ) - }, - label = stringResource(id = R.string.calendar_animation_label) - ) { targetState -> - if (!targetState) { - CalendarMonths( - modifier = Modifier.fillMaxSize(), - selectedDate = selectedDate, - onDateSelected = { - viewModel.updateSelectedDate(it) - }, - listState = listState, - pages = state.getPageCount(), - scrapLists = viewModel.mockScrapList, - ) - } else { - CalendarWeekWithScrap( - modifier = Modifier - .fillMaxSize(), - selectedDate = selectedDate, - scrapLists = viewModel.mockScrapList, - onDateSelected = { - viewModel.updateSelectedDate(it) - } - ) + CalendarWeekWithScrap( + modifier = Modifier + .fillMaxSize(), + selectedDate = selectedDate, + scrapLists = viewModel.mockScrapList, + onDateSelected = { + viewModel.updateSelectedDate(it) + } + ) + } } } } } + } } From 4aedbd6494813a5b44faf5f9da47b4679ea27376 Mon Sep 17 00:00:00 2001 From: boiledegg Date: Thu, 11 Jul 2024 22:36:19 +0900 Subject: [PATCH 16/24] =?UTF-8?q?[MOVE/#37]=20=ED=83=91=EB=B0=94=20?= =?UTF-8?q?=ED=8C=A8=ED=82=A4=EC=A7=80=20=EC=9D=B4=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/topappbar}/CalendarTopBar.kt | 35 +++++++++++-------- .../drawable/ic_calendar_list_selected.xml | 13 +++++++ .../drawable/ic_calendar_list_unselected.xml | 13 +++++++ .../main/res/drawable/ic_calendar_next.xml | 9 +++++ .../res/drawable/ic_calendar_previous.xml | 13 +++++++ core/src/main/res/values/strings.xml | 7 +++- 6 files changed, 75 insertions(+), 15 deletions(-) rename {feature/src/main/java/com/terning/feature/calendar/component => core/src/main/java/com/terning/core/designsystem/component/topappbar}/CalendarTopBar.kt (74%) create mode 100644 core/src/main/res/drawable/ic_calendar_list_selected.xml create mode 100644 core/src/main/res/drawable/ic_calendar_list_unselected.xml create mode 100644 core/src/main/res/drawable/ic_calendar_next.xml create mode 100644 core/src/main/res/drawable/ic_calendar_previous.xml diff --git a/feature/src/main/java/com/terning/feature/calendar/component/CalendarTopBar.kt b/core/src/main/java/com/terning/core/designsystem/component/topappbar/CalendarTopBar.kt similarity index 74% rename from feature/src/main/java/com/terning/feature/calendar/component/CalendarTopBar.kt rename to core/src/main/java/com/terning/core/designsystem/component/topappbar/CalendarTopBar.kt index cd16a1fe1..d49b62700 100644 --- a/feature/src/main/java/com/terning/feature/calendar/component/CalendarTopBar.kt +++ b/core/src/main/java/com/terning/core/designsystem/component/topappbar/CalendarTopBar.kt @@ -1,4 +1,4 @@ -package com.terning.feature.calendar.component +package com.terning.core.designsystem.component.topappbar import androidx.compose.foundation.background import androidx.compose.foundation.layout.Box @@ -15,6 +15,7 @@ import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp +import com.terning.core.R import com.terning.core.designsystem.theme.Black import com.terning.core.designsystem.theme.Grey300 import com.terning.core.designsystem.theme.TerningMain @@ -22,13 +23,13 @@ import com.terning.core.designsystem.theme.TerningPointTheme import com.terning.core.designsystem.theme.TerningTheme import com.terning.core.extension.getStringAsTitle import com.terning.core.extension.noRippleClickable -import com.terning.feature.R import java.time.LocalDate @Composable fun CalendarTopBar( modifier: Modifier = Modifier, date: LocalDate, + isWeekExpanded: Boolean, isListExpanded: Boolean, onListButtonClicked: () -> Unit, onMonthNavigationButtonClicked: (Int) -> Unit, @@ -48,24 +49,28 @@ fun CalendarTopBar( modifier = Modifier.align(Alignment.Center), verticalAlignment = Alignment.CenterVertically ) { - Icon( - painter = painterResource(id = R.drawable.ic_calendar_previous), - contentDescription = stringResource(id = R.string.calendar_button_description_previous), - tint = Grey300, - modifier = Modifier.noRippleClickable { onMonthNavigationButtonClicked(-1) } - ) + if(!isWeekExpanded) { + Icon( + painter = painterResource(id = R.drawable.ic_calendar_previous), + contentDescription = stringResource(id = R.string.calendar_button_description_previous), + tint = Grey300, + modifier = Modifier.noRippleClickable { onMonthNavigationButtonClicked(-1) } + ) + } Text( text = date.getStringAsTitle(), style = TerningTheme.typography.title2, color = Black, modifier = Modifier.padding(horizontal = 8.dp) ) - Icon( - painter = painterResource(id = R.drawable.ic_calendar_next), - contentDescription = stringResource(id = R.string.calendar_button_description_next), - tint = Grey300, - modifier = Modifier.noRippleClickable { onMonthNavigationButtonClicked(1) } - ) + if(!isWeekExpanded) { + Icon( + painter = painterResource(id = R.drawable.ic_calendar_next), + contentDescription = stringResource(id = R.string.calendar_button_description_next), + tint = Grey300, + modifier = Modifier.noRippleClickable { onMonthNavigationButtonClicked(1) } + ) + } } Box( modifier = Modifier @@ -94,6 +99,8 @@ fun CalendarTopBarPreview() { CalendarTopBar( date = LocalDate.now(), isListExpanded = false, + isWeekExpanded = false + , onListButtonClicked = {}, onMonthNavigationButtonClicked = {} ) diff --git a/core/src/main/res/drawable/ic_calendar_list_selected.xml b/core/src/main/res/drawable/ic_calendar_list_selected.xml new file mode 100644 index 000000000..686920353 --- /dev/null +++ b/core/src/main/res/drawable/ic_calendar_list_selected.xml @@ -0,0 +1,13 @@ + + + + + + diff --git a/core/src/main/res/drawable/ic_calendar_list_unselected.xml b/core/src/main/res/drawable/ic_calendar_list_unselected.xml new file mode 100644 index 000000000..fa8821985 --- /dev/null +++ b/core/src/main/res/drawable/ic_calendar_list_unselected.xml @@ -0,0 +1,13 @@ + + + + + + diff --git a/core/src/main/res/drawable/ic_calendar_next.xml b/core/src/main/res/drawable/ic_calendar_next.xml new file mode 100644 index 000000000..36a9b4af7 --- /dev/null +++ b/core/src/main/res/drawable/ic_calendar_next.xml @@ -0,0 +1,9 @@ + + + diff --git a/core/src/main/res/drawable/ic_calendar_previous.xml b/core/src/main/res/drawable/ic_calendar_previous.xml new file mode 100644 index 000000000..f9001fd4b --- /dev/null +++ b/core/src/main/res/drawable/ic_calendar_previous.xml @@ -0,0 +1,13 @@ + + + + + + diff --git a/core/src/main/res/values/strings.xml b/core/src/main/res/values/strings.xml index d8a46b213..832842691 100644 --- a/core/src/main/res/values/strings.xml +++ b/core/src/main/res/values/strings.xml @@ -11,10 +11,15 @@ button - + 근무기간 %s개월 D-%s 스크랩 + + previous + next + list + \ No newline at end of file From 9af616213a4afeaaa9be50ccf228f75d0e65cc4f Mon Sep 17 00:00:00 2001 From: boiledegg Date: Thu, 11 Jul 2024 22:37:35 +0900 Subject: [PATCH 17/24] =?UTF-8?q?[UI/#37]=20=ED=8C=A8=ED=82=A4=EC=A7=80=20?= =?UTF-8?q?=EA=B5=AC=EC=A1=B0=20=EC=88=98=EC=A0=95=20=EB=B0=8F=20=EB=A6=AC?= =?UTF-8?q?=EC=8A=A4=ED=8A=B8=20=EB=A1=9C=EC=A7=81=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../calendar/{ => calendar}/CalendarDay.kt | 2 +- .../calendar/{ => calendar}/CalendarMonth.kt | 3 ++- .../calendar/{ => calendar}/CalendarMonths.kt | 2 +- .../calendar/{ => calendar}/CalendarRoute.kt | 13 ++++++----- .../{ => calendar}/CalendarViewModel.kt | 2 +- .../calendar/{ => calendar}/CalendarWeek.kt | 6 +++-- .../{ => calendar}/CalendarWeekWithScrap.kt | 12 ++-------- .../component/WeekDaysHeader.kt | 2 +- .../calendar/navigation/CalendarNavigation.kt | 2 +- .../calendar/{ => scrap}/CalendarScrap.kt | 2 +- .../calendar/{ => scrap}/CalendarScrapList.kt | 22 ++++++++++++------- .../{ => scrap}/CalendarScrapStrip.kt | 2 +- 12 files changed, 36 insertions(+), 34 deletions(-) rename feature/src/main/java/com/terning/feature/calendar/{ => calendar}/CalendarDay.kt (98%) rename feature/src/main/java/com/terning/feature/calendar/{ => calendar}/CalendarMonth.kt (96%) rename feature/src/main/java/com/terning/feature/calendar/{ => calendar}/CalendarMonths.kt (97%) rename feature/src/main/java/com/terning/feature/calendar/{ => calendar}/CalendarRoute.kt (95%) rename feature/src/main/java/com/terning/feature/calendar/{ => calendar}/CalendarViewModel.kt (98%) rename feature/src/main/java/com/terning/feature/calendar/{ => calendar}/CalendarWeek.kt (93%) rename feature/src/main/java/com/terning/feature/calendar/{ => calendar}/CalendarWeekWithScrap.kt (84%) rename feature/src/main/java/com/terning/feature/calendar/{ => calendar}/component/WeekDaysHeader.kt (97%) rename feature/src/main/java/com/terning/feature/calendar/{ => scrap}/CalendarScrap.kt (97%) rename feature/src/main/java/com/terning/feature/calendar/{ => scrap}/CalendarScrapList.kt (80%) rename feature/src/main/java/com/terning/feature/calendar/{ => scrap}/CalendarScrapStrip.kt (97%) diff --git a/feature/src/main/java/com/terning/feature/calendar/CalendarDay.kt b/feature/src/main/java/com/terning/feature/calendar/calendar/CalendarDay.kt similarity index 98% rename from feature/src/main/java/com/terning/feature/calendar/CalendarDay.kt rename to feature/src/main/java/com/terning/feature/calendar/calendar/CalendarDay.kt index fe4af64e2..14a3b8656 100644 --- a/feature/src/main/java/com/terning/feature/calendar/CalendarDay.kt +++ b/feature/src/main/java/com/terning/feature/calendar/calendar/CalendarDay.kt @@ -1,4 +1,4 @@ -package com.terning.feature.calendar +package com.terning.feature.calendar.calendar import androidx.compose.foundation.background import androidx.compose.foundation.clickable diff --git a/feature/src/main/java/com/terning/feature/calendar/CalendarMonth.kt b/feature/src/main/java/com/terning/feature/calendar/calendar/CalendarMonth.kt similarity index 96% rename from feature/src/main/java/com/terning/feature/calendar/CalendarMonth.kt rename to feature/src/main/java/com/terning/feature/calendar/calendar/CalendarMonth.kt index 3b2cdf6e7..b4cf0c031 100644 --- a/feature/src/main/java/com/terning/feature/calendar/CalendarMonth.kt +++ b/feature/src/main/java/com/terning/feature/calendar/calendar/CalendarMonth.kt @@ -1,4 +1,4 @@ -package com.terning.feature.calendar +package com.terning.feature.calendar.calendar import androidx.compose.foundation.background import androidx.compose.foundation.layout.Column @@ -16,6 +16,7 @@ import androidx.compose.ui.unit.dp import com.terning.core.designsystem.theme.Grey150 import com.terning.core.designsystem.theme.TerningPointTheme import com.terning.core.extension.isToday +import com.terning.feature.calendar.scrap.CalendarScrapStrip import com.terning.feature.calendar.models.MonthData import com.terning.feature.calendar.models.Scrap import com.terning.feature.calendar.models.SelectedDateState diff --git a/feature/src/main/java/com/terning/feature/calendar/CalendarMonths.kt b/feature/src/main/java/com/terning/feature/calendar/calendar/CalendarMonths.kt similarity index 97% rename from feature/src/main/java/com/terning/feature/calendar/CalendarMonths.kt rename to feature/src/main/java/com/terning/feature/calendar/calendar/CalendarMonths.kt index 5d4ecc101..5d6e9d6c3 100644 --- a/feature/src/main/java/com/terning/feature/calendar/CalendarMonths.kt +++ b/feature/src/main/java/com/terning/feature/calendar/calendar/CalendarMonths.kt @@ -1,4 +1,4 @@ -package com.terning.feature.calendar +package com.terning.feature.calendar.calendar import androidx.compose.foundation.background import androidx.compose.foundation.lazy.LazyListState diff --git a/feature/src/main/java/com/terning/feature/calendar/CalendarRoute.kt b/feature/src/main/java/com/terning/feature/calendar/calendar/CalendarRoute.kt similarity index 95% rename from feature/src/main/java/com/terning/feature/calendar/CalendarRoute.kt rename to feature/src/main/java/com/terning/feature/calendar/calendar/CalendarRoute.kt index 238abeedd..e17e3b1a1 100644 --- a/feature/src/main/java/com/terning/feature/calendar/CalendarRoute.kt +++ b/feature/src/main/java/com/terning/feature/calendar/calendar/CalendarRoute.kt @@ -1,4 +1,4 @@ -package com.terning.feature.calendar +package com.terning.feature.calendar.calendar import androidx.activity.compose.BackHandler import androidx.compose.animation.AnimatedContent @@ -19,7 +19,6 @@ import androidx.compose.foundation.lazy.rememberLazyListState import androidx.compose.material3.Scaffold import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect -import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableIntStateOf import androidx.compose.runtime.mutableStateOf @@ -34,8 +33,9 @@ import androidx.hilt.navigation.compose.hiltViewModel import androidx.lifecycle.compose.collectAsStateWithLifecycle import com.terning.core.designsystem.theme.Grey200 import com.terning.feature.R -import com.terning.feature.calendar.component.CalendarTopBar -import com.terning.feature.calendar.component.WeekDaysHeader +import com.terning.feature.calendar.scrap.CalendarScrapList +import com.terning.core.designsystem.component.topappbar.CalendarTopBar +import com.terning.feature.calendar.calendar.component.WeekDaysHeader import com.terning.feature.calendar.models.CalendarState import kotlinx.coroutines.flow.distinctUntilChanged import kotlinx.coroutines.launch @@ -87,6 +87,7 @@ fun CalendarScreen( CalendarTopBar( date = currentDate, isListExpanded = isListExpanded, + isWeekExpanded = selectedDate.isEnabled, onListButtonClicked = { isListExpanded = !isListExpanded }, onMonthNavigationButtonClicked = { direction -> coroutineScope.launch { @@ -167,8 +168,8 @@ fun CalendarScreen( .fillMaxSize(), selectedDate = selectedDate, scrapLists = viewModel.mockScrapList, - onDateSelected = { - viewModel.updateSelectedDate(it) + onDateSelected = {newDate-> + viewModel.updateSelectedDate(newDate) } ) } diff --git a/feature/src/main/java/com/terning/feature/calendar/CalendarViewModel.kt b/feature/src/main/java/com/terning/feature/calendar/calendar/CalendarViewModel.kt similarity index 98% rename from feature/src/main/java/com/terning/feature/calendar/CalendarViewModel.kt rename to feature/src/main/java/com/terning/feature/calendar/calendar/CalendarViewModel.kt index fc7ebfe60..0d90b33ed 100644 --- a/feature/src/main/java/com/terning/feature/calendar/CalendarViewModel.kt +++ b/feature/src/main/java/com/terning/feature/calendar/calendar/CalendarViewModel.kt @@ -1,4 +1,4 @@ -package com.terning.feature.calendar +package com.terning.feature.calendar.calendar import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope diff --git a/feature/src/main/java/com/terning/feature/calendar/CalendarWeek.kt b/feature/src/main/java/com/terning/feature/calendar/calendar/CalendarWeek.kt similarity index 93% rename from feature/src/main/java/com/terning/feature/calendar/CalendarWeek.kt rename to feature/src/main/java/com/terning/feature/calendar/calendar/CalendarWeek.kt index 51b21b777..64a2c162d 100644 --- a/feature/src/main/java/com/terning/feature/calendar/CalendarWeek.kt +++ b/feature/src/main/java/com/terning/feature/calendar/calendar/CalendarWeek.kt @@ -1,4 +1,4 @@ -package com.terning.feature.calendar +package com.terning.feature.calendar.calendar import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.fillMaxWidth @@ -13,14 +13,16 @@ import androidx.compose.ui.unit.dp import com.terning.core.extension.getWeekIndexContainingSelectedDate import com.terning.core.extension.isToday import com.terning.feature.calendar.models.MonthData +import com.terning.feature.calendar.models.Scrap import com.terning.feature.calendar.models.SelectedDateState import java.time.LocalDate import java.time.YearMonth @Composable fun CalendarWeek( - modifier: Modifier = Modifier, selectedDate: SelectedDateState, + modifier: Modifier = Modifier, + scrapLists: List> = listOf(), onDateSelected: (LocalDate) -> Unit = {} ) { val date = selectedDate.selectedDate diff --git a/feature/src/main/java/com/terning/feature/calendar/CalendarWeekWithScrap.kt b/feature/src/main/java/com/terning/feature/calendar/calendar/CalendarWeekWithScrap.kt similarity index 84% rename from feature/src/main/java/com/terning/feature/calendar/CalendarWeekWithScrap.kt rename to feature/src/main/java/com/terning/feature/calendar/calendar/CalendarWeekWithScrap.kt index 11f7dfcb5..0afd8d6e5 100644 --- a/feature/src/main/java/com/terning/feature/calendar/CalendarWeekWithScrap.kt +++ b/feature/src/main/java/com/terning/feature/calendar/calendar/CalendarWeekWithScrap.kt @@ -1,32 +1,24 @@ -package com.terning.feature.calendar +package com.terning.feature.calendar.calendar import androidx.compose.foundation.background import androidx.compose.foundation.border -import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.Spacer -import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth -import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding -import androidx.compose.foundation.lazy.LazyColumn -import androidx.compose.foundation.lazy.items import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material3.Card import androidx.compose.material3.Text import androidx.compose.runtime.Composable -import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.shadow import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.dp import com.terning.core.designsystem.theme.Back -import com.terning.core.designsystem.theme.Black import com.terning.core.designsystem.theme.Grey200 import com.terning.core.designsystem.theme.Grey400 import com.terning.core.designsystem.theme.TerningTheme import com.terning.core.designsystem.theme.White -import com.terning.core.extension.getDateStringInKorean +import com.terning.feature.calendar.scrap.CalendarScrapList import com.terning.feature.calendar.models.Scrap import com.terning.feature.calendar.models.SelectedDateState import java.time.LocalDate diff --git a/feature/src/main/java/com/terning/feature/calendar/component/WeekDaysHeader.kt b/feature/src/main/java/com/terning/feature/calendar/calendar/component/WeekDaysHeader.kt similarity index 97% rename from feature/src/main/java/com/terning/feature/calendar/component/WeekDaysHeader.kt rename to feature/src/main/java/com/terning/feature/calendar/calendar/component/WeekDaysHeader.kt index 098459ce0..e02bde2ce 100644 --- a/feature/src/main/java/com/terning/feature/calendar/component/WeekDaysHeader.kt +++ b/feature/src/main/java/com/terning/feature/calendar/calendar/component/WeekDaysHeader.kt @@ -1,4 +1,4 @@ -package com.terning.feature.calendar.component +package com.terning.feature.calendar.calendar.component import androidx.compose.foundation.background import androidx.compose.foundation.layout.Row diff --git a/feature/src/main/java/com/terning/feature/calendar/navigation/CalendarNavigation.kt b/feature/src/main/java/com/terning/feature/calendar/navigation/CalendarNavigation.kt index 542b876d8..1725d9eb7 100644 --- a/feature/src/main/java/com/terning/feature/calendar/navigation/CalendarNavigation.kt +++ b/feature/src/main/java/com/terning/feature/calendar/navigation/CalendarNavigation.kt @@ -5,7 +5,7 @@ import androidx.navigation.NavGraphBuilder import androidx.navigation.NavOptions import androidx.navigation.compose.composable import com.terning.core.navigation.MainTabRoute -import com.terning.feature.calendar.CalendarRoute +import com.terning.feature.calendar.calendar.CalendarRoute import kotlinx.serialization.Serializable diff --git a/feature/src/main/java/com/terning/feature/calendar/CalendarScrap.kt b/feature/src/main/java/com/terning/feature/calendar/scrap/CalendarScrap.kt similarity index 97% rename from feature/src/main/java/com/terning/feature/calendar/CalendarScrap.kt rename to feature/src/main/java/com/terning/feature/calendar/scrap/CalendarScrap.kt index b5ea056c2..d89c1e9b2 100644 --- a/feature/src/main/java/com/terning/feature/calendar/CalendarScrap.kt +++ b/feature/src/main/java/com/terning/feature/calendar/scrap/CalendarScrap.kt @@ -1,4 +1,4 @@ -package com.terning.feature.calendar +package com.terning.feature.calendar.scrap import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height diff --git a/feature/src/main/java/com/terning/feature/calendar/CalendarScrapList.kt b/feature/src/main/java/com/terning/feature/calendar/scrap/CalendarScrapList.kt similarity index 80% rename from feature/src/main/java/com/terning/feature/calendar/CalendarScrapList.kt rename to feature/src/main/java/com/terning/feature/calendar/scrap/CalendarScrapList.kt index 9783b06ee..10f6f0b70 100644 --- a/feature/src/main/java/com/terning/feature/calendar/CalendarScrapList.kt +++ b/feature/src/main/java/com/terning/feature/calendar/scrap/CalendarScrapList.kt @@ -1,6 +1,8 @@ -package com.terning.feature.calendar +package com.terning.feature.calendar.scrap import androidx.compose.foundation.background +import androidx.compose.foundation.gestures.rememberScrollableState +import androidx.compose.foundation.gestures.scrollable import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxSize @@ -8,7 +10,8 @@ import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.lazy.LazyColumn -import androidx.compose.foundation.lazy.items +import androidx.compose.foundation.rememberScrollState +import androidx.compose.foundation.verticalScroll import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier @@ -35,9 +38,9 @@ fun CalendarScrapList( items(scrapList.size) { val currentDate = LocalDate.of(date.year, date.monthValue, it + 1) CalendarScrapList( - isFromListScreen = true, selectedDate = currentDate, scrapLists = scrapList, + isFromList = true, noScrapScreen = {}) @@ -58,9 +61,10 @@ fun CalendarScrapList( fun CalendarScrapList( selectedDate: LocalDate, scrapLists: List>, - isFromListScreen: Boolean = false, + isFromList: Boolean = false, noScrapScreen: @Composable () -> Unit ) { + val scrollState = rememberScrollState() if (scrapLists[selectedDate.dayOfMonth - 1].isNotEmpty()) { Text( text = selectedDate.getDateStringInKorean(), @@ -69,15 +73,17 @@ fun CalendarScrapList( modifier = Modifier.padding(start = 24.dp, top = 16.dp, bottom = 15.dp) ) } - + val topModifier = if(!isFromList) { + Modifier.fillMaxWidth().padding(horizontal = 24.dp).verticalScroll(scrollState) + } else { + Modifier.fillMaxWidth().padding(horizontal = 24.dp) + } if (scrapLists[selectedDate.dayOfMonth - 1].isEmpty()) { noScrapScreen() } else { Column( - modifier = Modifier - .fillMaxWidth() - .padding(horizontal = 24.dp), + modifier = topModifier ) { for (scrap in scrapLists[selectedDate.dayOfMonth - 1]) { CalendarScrap( diff --git a/feature/src/main/java/com/terning/feature/calendar/CalendarScrapStrip.kt b/feature/src/main/java/com/terning/feature/calendar/scrap/CalendarScrapStrip.kt similarity index 97% rename from feature/src/main/java/com/terning/feature/calendar/CalendarScrapStrip.kt rename to feature/src/main/java/com/terning/feature/calendar/scrap/CalendarScrapStrip.kt index a06842b05..34e8bdcf3 100644 --- a/feature/src/main/java/com/terning/feature/calendar/CalendarScrapStrip.kt +++ b/feature/src/main/java/com/terning/feature/calendar/scrap/CalendarScrapStrip.kt @@ -1,4 +1,4 @@ -package com.terning.feature.calendar +package com.terning.feature.calendar.scrap import androidx.compose.foundation.background import androidx.compose.foundation.layout.fillMaxWidth From 38108024aa7d1530afe5948c98bf4049a374c8f9 Mon Sep 17 00:00:00 2001 From: boiledegg Date: Thu, 11 Jul 2024 22:59:50 +0900 Subject: [PATCH 18/24] =?UTF-8?q?[UI/#37]=20=ED=8C=A8=ED=82=A4=EC=A7=80=20?= =?UTF-8?q?=EA=B5=AC=EC=A1=B0=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../calendar/scrap/CalendarScrapListScreen.kt | 72 +++++++++++++++++++ .../drawable/ic_calendar_list_selected.xml | 13 ---- .../drawable/ic_calendar_list_unselected.xml | 13 ---- .../main/res/drawable/ic_calendar_next.xml | 9 --- .../res/drawable/ic_calendar_previous.xml | 13 ---- 5 files changed, 72 insertions(+), 48 deletions(-) create mode 100644 feature/src/main/java/com/terning/feature/calendar/scrap/CalendarScrapListScreen.kt delete mode 100644 feature/src/main/res/drawable/ic_calendar_list_selected.xml delete mode 100644 feature/src/main/res/drawable/ic_calendar_list_unselected.xml delete mode 100644 feature/src/main/res/drawable/ic_calendar_next.xml delete mode 100644 feature/src/main/res/drawable/ic_calendar_previous.xml diff --git a/feature/src/main/java/com/terning/feature/calendar/scrap/CalendarScrapListScreen.kt b/feature/src/main/java/com/terning/feature/calendar/scrap/CalendarScrapListScreen.kt new file mode 100644 index 000000000..59648a203 --- /dev/null +++ b/feature/src/main/java/com/terning/feature/calendar/scrap/CalendarScrapListScreen.kt @@ -0,0 +1,72 @@ +package com.terning.feature.calendar.scrap + +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.fillMaxHeight +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.height +import androidx.compose.foundation.lazy.LazyColumn +import androidx.compose.foundation.lazy.LazyListState +import androidx.compose.foundation.lazy.LazyRow +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.unit.dp +import com.terning.core.designsystem.theme.Back +import com.terning.core.designsystem.theme.Grey200 +import com.terning.core.designsystem.theme.White +import com.terning.feature.calendar.models.CalendarDefaults.flingBehavior +import com.terning.feature.calendar.models.CalendarState.Companion.getDateByPage +import com.terning.feature.calendar.models.Scrap +import java.time.LocalDate + +@Composable +fun CalendarScrapListScreen( + date: LocalDate, + scrapList: List>, + pages: Int, + listState: LazyListState, + modifier: Modifier = Modifier +) { + LazyRow( + modifier = modifier + .background(White), + state = listState, + userScrollEnabled = true, + flingBehavior = flingBehavior( + state = listState + ) + ) { + items(pages) { page -> + val getDate = getDateByPage(page) + + LazyColumn( + modifier = Modifier + .fillParentMaxWidth() + .fillMaxHeight() + .background(Back) + ) { + items(scrapList.size) { day -> + val currentDate = LocalDate.of(getDate.year, getDate.monthValue, day + 1) + CalendarScrapList( + selectedDate = currentDate, + scrapLists = scrapList, + isFromList = true, + noScrapScreen = {}) + + + if (scrapList[day].isNotEmpty()) { + Spacer( + modifier = Modifier + .height(4.dp) + .fillMaxWidth() + .background(Grey200) + ) + } + } + } + } + } + +} + diff --git a/feature/src/main/res/drawable/ic_calendar_list_selected.xml b/feature/src/main/res/drawable/ic_calendar_list_selected.xml deleted file mode 100644 index 686920353..000000000 --- a/feature/src/main/res/drawable/ic_calendar_list_selected.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - diff --git a/feature/src/main/res/drawable/ic_calendar_list_unselected.xml b/feature/src/main/res/drawable/ic_calendar_list_unselected.xml deleted file mode 100644 index fa8821985..000000000 --- a/feature/src/main/res/drawable/ic_calendar_list_unselected.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - diff --git a/feature/src/main/res/drawable/ic_calendar_next.xml b/feature/src/main/res/drawable/ic_calendar_next.xml deleted file mode 100644 index 36a9b4af7..000000000 --- a/feature/src/main/res/drawable/ic_calendar_next.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - diff --git a/feature/src/main/res/drawable/ic_calendar_previous.xml b/feature/src/main/res/drawable/ic_calendar_previous.xml deleted file mode 100644 index f9001fd4b..000000000 --- a/feature/src/main/res/drawable/ic_calendar_previous.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - From 1f55cf5b453058d9cc569cb02f1e12f4df3d9f92 Mon Sep 17 00:00:00 2001 From: boiledegg Date: Thu, 11 Jul 2024 23:00:30 +0900 Subject: [PATCH 19/24] =?UTF-8?q?[UI/#37]=20=EC=8A=A4=ED=81=AC=EB=9E=A9=20?= =?UTF-8?q?=EB=AA=A9=EB=A1=9D=20=ED=99=94=EB=A9=B4=20=EC=8A=A4=ED=81=AC?= =?UTF-8?q?=EB=A1=A4=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../calendar/calendar/CalendarRoute.kt | 8 ++-- .../calendar/scrap/CalendarScrapList.kt | 40 ------------------- 2 files changed, 5 insertions(+), 43 deletions(-) diff --git a/feature/src/main/java/com/terning/feature/calendar/calendar/CalendarRoute.kt b/feature/src/main/java/com/terning/feature/calendar/calendar/CalendarRoute.kt index e17e3b1a1..c1242085d 100644 --- a/feature/src/main/java/com/terning/feature/calendar/calendar/CalendarRoute.kt +++ b/feature/src/main/java/com/terning/feature/calendar/calendar/CalendarRoute.kt @@ -37,6 +37,7 @@ import com.terning.feature.calendar.scrap.CalendarScrapList import com.terning.core.designsystem.component.topappbar.CalendarTopBar import com.terning.feature.calendar.calendar.component.WeekDaysHeader import com.terning.feature.calendar.models.CalendarState +import com.terning.feature.calendar.scrap.CalendarScrapListScreen import kotlinx.coroutines.flow.distinctUntilChanged import kotlinx.coroutines.launch import java.time.LocalDate @@ -115,12 +116,13 @@ fun CalendarScreen( label = "List Transition" ) { if (it) { - CalendarScrapList( + CalendarScrapListScreen( modifier = Modifier - .fillMaxSize() .padding(top = paddingValues.calculateTopPadding()), date = currentDate, - scrapList = viewModel.mockScrapList + scrapList = viewModel.mockScrapList, + listState = listState, + pages = state.getPageCount(), ) } else { Column( diff --git a/feature/src/main/java/com/terning/feature/calendar/scrap/CalendarScrapList.kt b/feature/src/main/java/com/terning/feature/calendar/scrap/CalendarScrapList.kt index 10f6f0b70..d379f5f57 100644 --- a/feature/src/main/java/com/terning/feature/calendar/scrap/CalendarScrapList.kt +++ b/feature/src/main/java/com/terning/feature/calendar/scrap/CalendarScrapList.kt @@ -1,62 +1,22 @@ package com.terning.feature.calendar.scrap -import androidx.compose.foundation.background -import androidx.compose.foundation.gestures.rememberScrollableState -import androidx.compose.foundation.gestures.scrollable import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Spacer -import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding -import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.verticalScroll import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp -import com.terning.core.designsystem.theme.Back import com.terning.core.designsystem.theme.Black -import com.terning.core.designsystem.theme.Grey200 import com.terning.core.designsystem.theme.TerningTheme import com.terning.core.extension.getDateStringInKorean import com.terning.feature.calendar.models.Scrap import java.time.LocalDate -@Composable -fun CalendarScrapList( - date: LocalDate, - scrapList: List>, - modifier: Modifier = Modifier -) { - LazyColumn( - modifier = modifier - .fillMaxSize() - .background(Back) - ) { - items(scrapList.size) { - val currentDate = LocalDate.of(date.year, date.monthValue, it + 1) - CalendarScrapList( - selectedDate = currentDate, - scrapLists = scrapList, - isFromList = true, - noScrapScreen = {}) - - - if(scrapList[it].isNotEmpty()) { - Spacer( - modifier = Modifier - .height(4.dp) - .fillMaxWidth() - .background(Grey200) - ) - } - } - } - -} - @Composable fun CalendarScrapList( selectedDate: LocalDate, From bb2d5da30559752707c4f3ad6d5b2c7fd04b3fbc Mon Sep 17 00:00:00 2001 From: boiledegg Date: Fri, 12 Jul 2024 00:57:30 +0900 Subject: [PATCH 20/24] =?UTF-8?q?[REFACTOR/#37]=20=EC=9E=84=ED=8F=AC?= =?UTF-8?q?=ED=8A=B8=20=EC=A0=95=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/terning/feature/calendar/calendar/CalendarMonth.kt | 2 +- .../com/terning/feature/calendar/calendar/CalendarRoute.kt | 4 +--- .../feature/calendar/calendar/CalendarWeekWithScrap.kt | 2 +- .../terning/feature/calendar/scrap/CalendarScrapListScreen.kt | 2 -- 4 files changed, 3 insertions(+), 7 deletions(-) diff --git a/feature/src/main/java/com/terning/feature/calendar/calendar/CalendarMonth.kt b/feature/src/main/java/com/terning/feature/calendar/calendar/CalendarMonth.kt index b4cf0c031..f3d64b6ab 100644 --- a/feature/src/main/java/com/terning/feature/calendar/calendar/CalendarMonth.kt +++ b/feature/src/main/java/com/terning/feature/calendar/calendar/CalendarMonth.kt @@ -16,10 +16,10 @@ import androidx.compose.ui.unit.dp import com.terning.core.designsystem.theme.Grey150 import com.terning.core.designsystem.theme.TerningPointTheme import com.terning.core.extension.isToday -import com.terning.feature.calendar.scrap.CalendarScrapStrip import com.terning.feature.calendar.models.MonthData import com.terning.feature.calendar.models.Scrap import com.terning.feature.calendar.models.SelectedDateState +import com.terning.feature.calendar.scrap.CalendarScrapStrip import java.time.LocalDate import java.time.YearMonth diff --git a/feature/src/main/java/com/terning/feature/calendar/calendar/CalendarRoute.kt b/feature/src/main/java/com/terning/feature/calendar/calendar/CalendarRoute.kt index c1242085d..ef33b56c8 100644 --- a/feature/src/main/java/com/terning/feature/calendar/calendar/CalendarRoute.kt +++ b/feature/src/main/java/com/terning/feature/calendar/calendar/CalendarRoute.kt @@ -31,10 +31,9 @@ import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import androidx.hilt.navigation.compose.hiltViewModel import androidx.lifecycle.compose.collectAsStateWithLifecycle +import com.terning.core.designsystem.component.topappbar.CalendarTopBar import com.terning.core.designsystem.theme.Grey200 import com.terning.feature.R -import com.terning.feature.calendar.scrap.CalendarScrapList -import com.terning.core.designsystem.component.topappbar.CalendarTopBar import com.terning.feature.calendar.calendar.component.WeekDaysHeader import com.terning.feature.calendar.models.CalendarState import com.terning.feature.calendar.scrap.CalendarScrapListScreen @@ -119,7 +118,6 @@ fun CalendarScreen( CalendarScrapListScreen( modifier = Modifier .padding(top = paddingValues.calculateTopPadding()), - date = currentDate, scrapList = viewModel.mockScrapList, listState = listState, pages = state.getPageCount(), diff --git a/feature/src/main/java/com/terning/feature/calendar/calendar/CalendarWeekWithScrap.kt b/feature/src/main/java/com/terning/feature/calendar/calendar/CalendarWeekWithScrap.kt index 0afd8d6e5..65a3a4db6 100644 --- a/feature/src/main/java/com/terning/feature/calendar/calendar/CalendarWeekWithScrap.kt +++ b/feature/src/main/java/com/terning/feature/calendar/calendar/CalendarWeekWithScrap.kt @@ -18,9 +18,9 @@ import com.terning.core.designsystem.theme.Grey200 import com.terning.core.designsystem.theme.Grey400 import com.terning.core.designsystem.theme.TerningTheme import com.terning.core.designsystem.theme.White -import com.terning.feature.calendar.scrap.CalendarScrapList import com.terning.feature.calendar.models.Scrap import com.terning.feature.calendar.models.SelectedDateState +import com.terning.feature.calendar.scrap.CalendarScrapList import java.time.LocalDate @Composable diff --git a/feature/src/main/java/com/terning/feature/calendar/scrap/CalendarScrapListScreen.kt b/feature/src/main/java/com/terning/feature/calendar/scrap/CalendarScrapListScreen.kt index 59648a203..1731b789b 100644 --- a/feature/src/main/java/com/terning/feature/calendar/scrap/CalendarScrapListScreen.kt +++ b/feature/src/main/java/com/terning/feature/calendar/scrap/CalendarScrapListScreen.kt @@ -3,7 +3,6 @@ package com.terning.feature.calendar.scrap import androidx.compose.foundation.background import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxHeight -import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.lazy.LazyColumn @@ -22,7 +21,6 @@ import java.time.LocalDate @Composable fun CalendarScrapListScreen( - date: LocalDate, scrapList: List>, pages: Int, listState: LazyListState, From a123cf28bc8e4d1d65630358198cd1b95a4978bb Mon Sep 17 00:00:00 2001 From: boiledegg Date: Fri, 12 Jul 2024 02:45:27 +0900 Subject: [PATCH 21/24] =?UTF-8?q?[UI/#37]=20=EC=9B=94=EA=B0=84-=EC=A3=BC?= =?UTF-8?q?=EA=B0=84-=EB=AA=A9=EB=A1=9D=20=EC=A0=84=ED=99=98=20=ED=9D=90?= =?UTF-8?q?=EB=A6=84=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../{CalendarTopBar.kt => CalendarTopAppBar.kt} | 8 ++++---- .../com/terning/core/extension/LocalDateExt.kt | 2 +- .../feature/calendar/calendar/CalendarRoute.kt | 10 +++++++--- .../calendar/calendar/CalendarViewModel.kt | 17 +++++++++++------ .../feature/calendar/calendar/CalendarWeek.kt | 7 +++++-- 5 files changed, 28 insertions(+), 16 deletions(-) rename core/src/main/java/com/terning/core/designsystem/component/topappbar/{CalendarTopBar.kt => CalendarTopAppBar.kt} (96%) diff --git a/core/src/main/java/com/terning/core/designsystem/component/topappbar/CalendarTopBar.kt b/core/src/main/java/com/terning/core/designsystem/component/topappbar/CalendarTopAppBar.kt similarity index 96% rename from core/src/main/java/com/terning/core/designsystem/component/topappbar/CalendarTopBar.kt rename to core/src/main/java/com/terning/core/designsystem/component/topappbar/CalendarTopAppBar.kt index d49b62700..a18a80fa6 100644 --- a/core/src/main/java/com/terning/core/designsystem/component/topappbar/CalendarTopBar.kt +++ b/core/src/main/java/com/terning/core/designsystem/component/topappbar/CalendarTopAppBar.kt @@ -26,7 +26,7 @@ import com.terning.core.extension.noRippleClickable import java.time.LocalDate @Composable -fun CalendarTopBar( +fun CalendarTopAppBar( modifier: Modifier = Modifier, date: LocalDate, isWeekExpanded: Boolean, @@ -49,7 +49,7 @@ fun CalendarTopBar( modifier = Modifier.align(Alignment.Center), verticalAlignment = Alignment.CenterVertically ) { - if(!isWeekExpanded) { + if(!isWeekExpanded || isListExpanded) { Icon( painter = painterResource(id = R.drawable.ic_calendar_previous), contentDescription = stringResource(id = R.string.calendar_button_description_previous), @@ -63,7 +63,7 @@ fun CalendarTopBar( color = Black, modifier = Modifier.padding(horizontal = 8.dp) ) - if(!isWeekExpanded) { + if(!isWeekExpanded || isListExpanded) { Icon( painter = painterResource(id = R.drawable.ic_calendar_next), contentDescription = stringResource(id = R.string.calendar_button_description_next), @@ -96,7 +96,7 @@ fun CalendarTopBar( @Composable fun CalendarTopBarPreview() { TerningPointTheme { - CalendarTopBar( + CalendarTopAppBar( date = LocalDate.now(), isListExpanded = false, isWeekExpanded = false diff --git a/core/src/main/java/com/terning/core/extension/LocalDateExt.kt b/core/src/main/java/com/terning/core/extension/LocalDateExt.kt index 31d49e9ce..ae9e81f13 100644 --- a/core/src/main/java/com/terning/core/extension/LocalDateExt.kt +++ b/core/src/main/java/com/terning/core/extension/LocalDateExt.kt @@ -10,6 +10,6 @@ fun LocalDate.getStringAsTitle(): String = fun LocalDate.getDateStringInKorean(): String = "${monthValue}월 ${dayOfMonth}일 ${dayOfWeek.getDisplayName(TextStyle.FULL, Locale.KOREAN)}" -fun LocalDate.getWeekIndexContainingSelectedDate(): Int = dayOfMonth / 7 +fun LocalDate.getWeekIndexContainingSelectedDate(inDays: Int): Int = (inDays + dayOfMonth) / 7 fun LocalDate.isToday(): Boolean = this == LocalDate.now() \ No newline at end of file diff --git a/feature/src/main/java/com/terning/feature/calendar/calendar/CalendarRoute.kt b/feature/src/main/java/com/terning/feature/calendar/calendar/CalendarRoute.kt index ef33b56c8..661e303bf 100644 --- a/feature/src/main/java/com/terning/feature/calendar/calendar/CalendarRoute.kt +++ b/feature/src/main/java/com/terning/feature/calendar/calendar/CalendarRoute.kt @@ -31,7 +31,7 @@ import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import androidx.hilt.navigation.compose.hiltViewModel import androidx.lifecycle.compose.collectAsStateWithLifecycle -import com.terning.core.designsystem.component.topappbar.CalendarTopBar +import com.terning.core.designsystem.component.topappbar.CalendarTopAppBar import com.terning.core.designsystem.theme.Grey200 import com.terning.feature.R import com.terning.feature.calendar.calendar.component.WeekDaysHeader @@ -84,11 +84,15 @@ fun CalendarScreen( modifier = modifier, topBar = { val coroutineScope = rememberCoroutineScope() - CalendarTopBar( + CalendarTopAppBar( date = currentDate, isListExpanded = isListExpanded, isWeekExpanded = selectedDate.isEnabled, - onListButtonClicked = { isListExpanded = !isListExpanded }, + onListButtonClicked = { + isListExpanded = !isListExpanded + if(selectedDate.isEnabled){ + viewModel.disableWeekCalendar() + } }, onMonthNavigationButtonClicked = { direction -> coroutineScope.launch { listState.animateScrollToItem( diff --git a/feature/src/main/java/com/terning/feature/calendar/calendar/CalendarViewModel.kt b/feature/src/main/java/com/terning/feature/calendar/calendar/CalendarViewModel.kt index 0d90b33ed..15a33ddf9 100644 --- a/feature/src/main/java/com/terning/feature/calendar/calendar/CalendarViewModel.kt +++ b/feature/src/main/java/com/terning/feature/calendar/calendar/CalendarViewModel.kt @@ -39,15 +39,20 @@ class CalendarViewModel @Inject constructor( ) } } else { - _selectedDate.update { currentState -> - currentState.copy( - selectedDate = date, - isEnabled = !_selectedDate.value.isEnabled - ) - } + disableWeekCalendar() } } + fun disableWeekCalendar() { + _selectedDate.update { currentState -> + currentState.copy( + isEnabled = false + ) + } + } + + + //To be erased in future val mockScrapList: List> get() { diff --git a/feature/src/main/java/com/terning/feature/calendar/calendar/CalendarWeek.kt b/feature/src/main/java/com/terning/feature/calendar/calendar/CalendarWeek.kt index 64a2c162d..409b5949c 100644 --- a/feature/src/main/java/com/terning/feature/calendar/calendar/CalendarWeek.kt +++ b/feature/src/main/java/com/terning/feature/calendar/calendar/CalendarWeek.kt @@ -15,6 +15,7 @@ import com.terning.core.extension.isToday import com.terning.feature.calendar.models.MonthData import com.terning.feature.calendar.models.Scrap import com.terning.feature.calendar.models.SelectedDateState +import timber.log.Timber import java.time.LocalDate import java.time.YearMonth @@ -22,18 +23,20 @@ import java.time.YearMonth fun CalendarWeek( selectedDate: SelectedDateState, modifier: Modifier = Modifier, - scrapLists: List> = listOf(), onDateSelected: (LocalDate) -> Unit = {} ) { val date = selectedDate.selectedDate val monthData = MonthData(YearMonth.of(date.year, date.monthValue)) - val currentWeek = date.getWeekIndexContainingSelectedDate() + val currentWeek = date.getWeekIndexContainingSelectedDate(monthData.inDays) val pagerState = rememberPagerState ( initialPage = currentWeek, pageCount = {monthData.totalDays / 7} ) + Timber.tag("CalendarScreen") + .d("currentWeek:$currentWeek, totalDays: ${monthData.totalDays}, ${monthData.totalDays / 7}") + HorizontalPager( modifier = modifier, state = pagerState) { page -> From ecf16b31b9c528a3d108a1eaff2557e054025c24 Mon Sep 17 00:00:00 2001 From: boiledegg Date: Fri, 12 Jul 2024 03:09:27 +0900 Subject: [PATCH 22/24] =?UTF-8?q?[CHORE/#37]=20=EB=A1=9C=EC=A7=81=20?= =?UTF-8?q?=EC=98=A4=EB=A5=98=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/terning/core/extension/LocalDateExt.kt | 2 +- .../com/terning/feature/calendar/calendar/CalendarRoute.kt | 4 ++-- .../terning/feature/calendar/calendar/CalendarViewModel.kt | 6 +++++- .../com/terning/feature/calendar/calendar/CalendarWeek.kt | 3 --- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/core/src/main/java/com/terning/core/extension/LocalDateExt.kt b/core/src/main/java/com/terning/core/extension/LocalDateExt.kt index ae9e81f13..702ea1182 100644 --- a/core/src/main/java/com/terning/core/extension/LocalDateExt.kt +++ b/core/src/main/java/com/terning/core/extension/LocalDateExt.kt @@ -10,6 +10,6 @@ fun LocalDate.getStringAsTitle(): String = fun LocalDate.getDateStringInKorean(): String = "${monthValue}월 ${dayOfMonth}일 ${dayOfWeek.getDisplayName(TextStyle.FULL, Locale.KOREAN)}" -fun LocalDate.getWeekIndexContainingSelectedDate(inDays: Int): Int = (inDays + dayOfMonth) / 7 +fun LocalDate.getWeekIndexContainingSelectedDate(inDays: Int): Int = (inDays + dayOfMonth - 1) / 7 fun LocalDate.isToday(): Boolean = this == LocalDate.now() \ No newline at end of file diff --git a/feature/src/main/java/com/terning/feature/calendar/calendar/CalendarRoute.kt b/feature/src/main/java/com/terning/feature/calendar/calendar/CalendarRoute.kt index 661e303bf..db0fb56b5 100644 --- a/feature/src/main/java/com/terning/feature/calendar/calendar/CalendarRoute.kt +++ b/feature/src/main/java/com/terning/feature/calendar/calendar/CalendarRoute.kt @@ -117,8 +117,8 @@ fun CalendarScreen( ) }, label = "List Transition" - ) { - if (it) { + ) { isListExpanded -> + if (isListExpanded) { CalendarScrapListScreen( modifier = Modifier .padding(top = paddingValues.calculateTopPadding()), diff --git a/feature/src/main/java/com/terning/feature/calendar/calendar/CalendarViewModel.kt b/feature/src/main/java/com/terning/feature/calendar/calendar/CalendarViewModel.kt index 15a33ddf9..49f263050 100644 --- a/feature/src/main/java/com/terning/feature/calendar/calendar/CalendarViewModel.kt +++ b/feature/src/main/java/com/terning/feature/calendar/calendar/CalendarViewModel.kt @@ -39,7 +39,11 @@ class CalendarViewModel @Inject constructor( ) } } else { - disableWeekCalendar() + _selectedDate.update { currentState -> + currentState.copy( + isEnabled = !currentState.isEnabled + ) + } } } diff --git a/feature/src/main/java/com/terning/feature/calendar/calendar/CalendarWeek.kt b/feature/src/main/java/com/terning/feature/calendar/calendar/CalendarWeek.kt index 409b5949c..ea6bb76b6 100644 --- a/feature/src/main/java/com/terning/feature/calendar/calendar/CalendarWeek.kt +++ b/feature/src/main/java/com/terning/feature/calendar/calendar/CalendarWeek.kt @@ -34,9 +34,6 @@ fun CalendarWeek( pageCount = {monthData.totalDays / 7} ) - Timber.tag("CalendarScreen") - .d("currentWeek:$currentWeek, totalDays: ${monthData.totalDays}, ${monthData.totalDays / 7}") - HorizontalPager( modifier = modifier, state = pagerState) { page -> From 8b77265816b83d2b540d1c43a2768e40e677eeba Mon Sep 17 00:00:00 2001 From: boiledegg Date: Fri, 12 Jul 2024 03:24:10 +0900 Subject: [PATCH 23/24] =?UTF-8?q?[CHORE/#37]=20InternItem=20=EB=A1=9C?= =?UTF-8?q?=EC=A7=81=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../designsystem/component/item/InternItem.kt | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/core/src/main/java/com/terning/core/designsystem/component/item/InternItem.kt b/core/src/main/java/com/terning/core/designsystem/component/item/InternItem.kt index 8bfab6919..1e659b21d 100644 --- a/core/src/main/java/com/terning/core/designsystem/component/item/InternItem.kt +++ b/core/src/main/java/com/terning/core/designsystem/component/item/InternItem.kt @@ -2,22 +2,16 @@ package com.terning.core.designsystem.component.item import androidx.compose.foundation.Image import androidx.compose.foundation.background -import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row -import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.aspectRatio import androidx.compose.foundation.layout.fillMaxHeight import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding -import androidx.compose.foundation.layout.width import androidx.compose.foundation.shape.RoundedCornerShape -import androidx.compose.material.icons.Icons -import androidx.compose.material.icons.filled.* -import androidx.compose.material.icons.outlined.Star import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment @@ -26,12 +20,8 @@ import androidx.compose.ui.draw.clip import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource -import androidx.compose.ui.text.SpanStyle -import androidx.compose.ui.text.buildAnnotatedString -import androidx.compose.ui.text.withStyle import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp -import androidx.core.text.buildSpannedString import coil.compose.AsyncImage import coil.request.ImageRequest import com.terning.core.R @@ -51,7 +41,8 @@ fun InternItem( workingPeriod: String, isScraped: Boolean, modifier: Modifier = Modifier, - onScrapButtonClicked: () -> Unit = {}, + scrapId: Int = 0, + onScrapButtonClicked: (Int) -> Unit = {}, ) { Row( modifier = modifier @@ -121,7 +112,7 @@ fun InternItem( modifier = modifier .align(Alignment.BottomEnd) .noRippleClickable { - onScrapButtonClicked() + onScrapButtonClicked(scrapId) }, ) } From 7203b87c5821d8f09fab2bb54bb2494f90240918 Mon Sep 17 00:00:00 2001 From: boiledegg Date: Fri, 12 Jul 2024 05:29:56 +0900 Subject: [PATCH 24/24] =?UTF-8?q?[REFACTOR/#37]=20=EB=A6=AC=EB=B7=B0=20?= =?UTF-8?q?=EA=B8=B0=EB=B0=98=20=EC=BD=94=EB=93=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../feature/calendar/calendar/CalendarMonth.kt | 9 ++++----- .../feature/calendar/calendar/CalendarRoute.kt | 12 ++++++------ .../calendar/calendar/CalendarWeekWithScrap.kt | 4 +++- .../feature/calendar/scrap/CalendarScrapList.kt | 11 ++++++++--- feature/src/main/res/values/strings.xml | 1 + 5 files changed, 22 insertions(+), 15 deletions(-) diff --git a/feature/src/main/java/com/terning/feature/calendar/calendar/CalendarMonth.kt b/feature/src/main/java/com/terning/feature/calendar/calendar/CalendarMonth.kt index f3d64b6ab..3d1822b5c 100644 --- a/feature/src/main/java/com/terning/feature/calendar/calendar/CalendarMonth.kt +++ b/feature/src/main/java/com/terning/feature/calendar/calendar/CalendarMonth.kt @@ -8,6 +8,7 @@ import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding +import androidx.compose.material3.HorizontalDivider import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier @@ -64,11 +65,9 @@ fun CalendarMonth( } } if(month.indexOf(week) != month.lastIndex) { - Spacer( - modifier = Modifier - .fillMaxWidth() - .height(1.dp) - .background(color = Grey150) + HorizontalDivider( + thickness = 1.dp, + color = Grey150 ) } } diff --git a/feature/src/main/java/com/terning/feature/calendar/calendar/CalendarRoute.kt b/feature/src/main/java/com/terning/feature/calendar/calendar/CalendarRoute.kt index db0fb56b5..7d8372b70 100644 --- a/feature/src/main/java/com/terning/feature/calendar/calendar/CalendarRoute.kt +++ b/feature/src/main/java/com/terning/feature/calendar/calendar/CalendarRoute.kt @@ -16,6 +16,7 @@ import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.lazy.rememberLazyListState +import androidx.compose.material3.HorizontalDivider import androidx.compose.material3.Scaffold import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect @@ -116,7 +117,7 @@ fun CalendarScreen( sizeTransform = SizeTransform(clip = true) ) }, - label = "List Transition" + label = stringResource(id = R.string.calendar_animation_label) ) { isListExpanded -> if (isListExpanded) { CalendarScrapListScreen( @@ -133,11 +134,10 @@ fun CalendarScreen( .padding(top = paddingValues.calculateTopPadding()) ) { WeekDaysHeader() - Spacer( - modifier = Modifier - .fillMaxWidth() - .height(1.dp) - .background(color = Grey200) + + HorizontalDivider( + thickness = 1.dp, + color = Grey200 ) AnimatedContent( diff --git a/feature/src/main/java/com/terning/feature/calendar/calendar/CalendarWeekWithScrap.kt b/feature/src/main/java/com/terning/feature/calendar/calendar/CalendarWeekWithScrap.kt index 65a3a4db6..54ab943b3 100644 --- a/feature/src/main/java/com/terning/feature/calendar/calendar/CalendarWeekWithScrap.kt +++ b/feature/src/main/java/com/terning/feature/calendar/calendar/CalendarWeekWithScrap.kt @@ -11,6 +11,7 @@ import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.draw.shadow +import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.dp import com.terning.core.designsystem.theme.Back @@ -18,6 +19,7 @@ import com.terning.core.designsystem.theme.Grey200 import com.terning.core.designsystem.theme.Grey400 import com.terning.core.designsystem.theme.TerningTheme import com.terning.core.designsystem.theme.White +import com.terning.feature.R import com.terning.feature.calendar.models.Scrap import com.terning.feature.calendar.models.SelectedDateState import com.terning.feature.calendar.scrap.CalendarScrapList @@ -64,7 +66,7 @@ fun CalendarWeekWithScrap( modifier = Modifier .padding(top = 42.dp) .fillMaxWidth(), - text = "선택하신 날짜에 지원 마감인 스크랩 공고가 없어요.", + text = stringResource(id = R.string.calendar_empty_scrap), textAlign = TextAlign.Center, style = TerningTheme.typography.body5, color = Grey400 diff --git a/feature/src/main/java/com/terning/feature/calendar/scrap/CalendarScrapList.kt b/feature/src/main/java/com/terning/feature/calendar/scrap/CalendarScrapList.kt index d379f5f57..d1a9dc1ff 100644 --- a/feature/src/main/java/com/terning/feature/calendar/scrap/CalendarScrapList.kt +++ b/feature/src/main/java/com/terning/feature/calendar/scrap/CalendarScrapList.kt @@ -33,10 +33,15 @@ fun CalendarScrapList( modifier = Modifier.padding(start = 24.dp, top = 16.dp, bottom = 15.dp) ) } - val topModifier = if(!isFromList) { - Modifier.fillMaxWidth().padding(horizontal = 24.dp).verticalScroll(scrollState) + val topModifier = if (!isFromList) { + Modifier + .fillMaxWidth() + .padding(horizontal = 24.dp) + .verticalScroll(scrollState) } else { - Modifier.fillMaxWidth().padding(horizontal = 24.dp) + Modifier + .fillMaxWidth() + .padding(horizontal = 24.dp) } if (scrapLists[selectedDate.dayOfMonth - 1].isEmpty()) { diff --git a/feature/src/main/res/values/strings.xml b/feature/src/main/res/values/strings.xml index 50b4c07a1..694b1ee2f 100644 --- a/feature/src/main/res/values/strings.xml +++ b/feature/src/main/res/values/strings.xml @@ -52,6 +52,7 @@ next list Calendar Transition + 선택하신 날짜에 지원 마감인 스크랩 공고가 없어요 오늘 마감되는 %s님의 관심 공고