From b55012872f44a13848b445b9d604b4ffa26efb87 Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Tue, 10 Dec 2024 20:38:11 +0900 Subject: [PATCH 01/19] =?UTF-8?q?[FEAT/#309]=20=EB=8D=B0=EC=9D=B4=ED=8A=B8?= =?UTF-8?q?=ED=94=BC=EC=BB=A4=20=ED=95=A8=EC=88=98=EB=AA=85=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=20=EB=B0=8F=20=EB=B9=84=ED=99=9C=EC=84=B1=ED=99=94=20?= =?UTF-8?q?=EC=95=84=EC=9D=B4=ED=85=9C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../filteringthree/FilteringThreeRoute.kt | 4 +- ...hPicker.kt => FilteringYearMonthPicker.kt} | 2 +- .../component/HomeFilteringBottomSheet.kt | 23 ++++++++-- ...rMonthPicker.kt => HomeYearMonthPicker.kt} | 43 +++++++++++-------- 4 files changed, 48 insertions(+), 24 deletions(-) rename feature/filtering/src/main/java/com/terning/feature/filtering/filteringthree/component/{YearMonthPicker.kt => FilteringYearMonthPicker.kt} (99%) rename feature/home/src/main/java/com/terning/feature/home/component/{YearMonthPicker.kt => HomeYearMonthPicker.kt} (82%) diff --git a/feature/filtering/src/main/java/com/terning/feature/filtering/filteringthree/FilteringThreeRoute.kt b/feature/filtering/src/main/java/com/terning/feature/filtering/filteringthree/FilteringThreeRoute.kt index d10a9298..c31df2fc 100644 --- a/feature/filtering/src/main/java/com/terning/feature/filtering/filteringthree/FilteringThreeRoute.kt +++ b/feature/filtering/src/main/java/com/terning/feature/filtering/filteringthree/FilteringThreeRoute.kt @@ -35,7 +35,7 @@ import com.terning.core.designsystem.theme.TerningPointTheme import com.terning.core.designsystem.theme.TerningTheme import com.terning.core.designsystem.theme.White import com.terning.feature.filtering.R -import com.terning.feature.filtering.filteringthree.component.YearMonthPicker +import com.terning.feature.filtering.filteringthree.component.FilteringYearMonthPicker import java.util.Calendar @Composable @@ -147,7 +147,7 @@ fun FilteringThreeScreen( ) ) Spacer(modifier = Modifier.height(61.dp)) - YearMonthPicker( + FilteringYearMonthPicker( chosenYear = chosenYear, chosenMonth = chosenMonth, onYearChosen = { onYearChosen(it) }, diff --git a/feature/filtering/src/main/java/com/terning/feature/filtering/filteringthree/component/YearMonthPicker.kt b/feature/filtering/src/main/java/com/terning/feature/filtering/filteringthree/component/FilteringYearMonthPicker.kt similarity index 99% rename from feature/filtering/src/main/java/com/terning/feature/filtering/filteringthree/component/YearMonthPicker.kt rename to feature/filtering/src/main/java/com/terning/feature/filtering/filteringthree/component/FilteringYearMonthPicker.kt index 9e870d11..5e77b1ba 100644 --- a/feature/filtering/src/main/java/com/terning/feature/filtering/filteringthree/component/YearMonthPicker.kt +++ b/feature/filtering/src/main/java/com/terning/feature/filtering/filteringthree/component/FilteringYearMonthPicker.kt @@ -56,7 +56,7 @@ class PickerState { fun rememberPickerState() = remember { PickerState() } @Composable -fun YearMonthPicker( +fun FilteringYearMonthPicker( modifier: Modifier = Modifier, chosenYear: Int, chosenMonth: Int, diff --git a/feature/home/src/main/java/com/terning/feature/home/component/HomeFilteringBottomSheet.kt b/feature/home/src/main/java/com/terning/feature/home/component/HomeFilteringBottomSheet.kt index 27fb6e5b..f0e22bc5 100644 --- a/feature/home/src/main/java/com/terning/feature/home/component/HomeFilteringBottomSheet.kt +++ b/feature/home/src/main/java/com/terning/feature/home/component/HomeFilteringBottomSheet.kt @@ -21,6 +21,7 @@ import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp +import com.terning.core.designsystem.R import com.terning.core.designsystem.component.bottomsheet.TerningBasicBottomSheet import com.terning.core.designsystem.component.button.ChangeFilterButton import com.terning.core.designsystem.component.button.RoundButton @@ -31,7 +32,6 @@ import com.terning.core.designsystem.theme.Grey200 import com.terning.core.designsystem.theme.TerningTheme import com.terning.core.designsystem.type.Grade import com.terning.core.designsystem.type.WorkingPeriod -import com.terning.core.designsystem.R import java.util.Calendar @OptIn(ExperimentalMaterial3Api::class) @@ -60,6 +60,9 @@ fun HomeFilteringBottomSheet( ) } + // todo: 삭제 + var nullDate by remember { mutableStateOf(false) } + TerningBasicBottomSheet( content = { Column( @@ -119,6 +122,8 @@ fun HomeFilteringBottomSheet( R.string.change_filter_period_3, ), onButtonClick = { index -> + // todo: 삭제 + nullDate = true currentPeriod = WorkingPeriod.entries[index] }, modifier = Modifier @@ -132,12 +137,22 @@ fun HomeFilteringBottomSheet( .padding(horizontal = 24.dp) ) - YearMonthPicker( + // todo: null 처리 제대로 + HomeYearMonthPicker( chosenYear = defaultStartYear ?: Calendar.getInstance().currentYear, chosenMonth = defaultStartMonth ?: Calendar.getInstance().currentMonth, - onYearChosen = { currentStartYear = it }, - onMonthChosen = { currentStartMonth = it } + onYearChosen = { + if (it != null) { + currentStartYear = it + } + }, + onMonthChosen = { + if (it != null) { + currentStartMonth = it + } + }, + nullDate = nullDate ) RoundButton( style = TerningTheme.typography.button0, diff --git a/feature/home/src/main/java/com/terning/feature/home/component/YearMonthPicker.kt b/feature/home/src/main/java/com/terning/feature/home/component/HomeYearMonthPicker.kt similarity index 82% rename from feature/home/src/main/java/com/terning/feature/home/component/YearMonthPicker.kt rename to feature/home/src/main/java/com/terning/feature/home/component/HomeYearMonthPicker.kt index 1771bc4b..535288b9 100644 --- a/feature/home/src/main/java/com/terning/feature/home/component/YearMonthPicker.kt +++ b/feature/home/src/main/java/com/terning/feature/home/component/HomeYearMonthPicker.kt @@ -56,25 +56,34 @@ class PickerState { fun rememberPickerState() = remember { PickerState() } @Composable -fun YearMonthPicker( +fun HomeYearMonthPicker( modifier: Modifier = Modifier, - chosenYear: Int, - chosenMonth: Int, - onYearChosen: (Int) -> Unit, - onMonthChosen: (Int) -> Unit, + chosenYear: Int?, + chosenMonth: Int?, + onYearChosen: (Int?) -> Unit, + onMonthChosen: (Int?) -> Unit, + nullDate: Boolean ) { + // todo: 변수명 제대로 + val yearsWithNull = if (nullDate) years + "-" else years + val monthsWithNull = if (nullDate) months + "-" else months + val yearPickerState = rememberPickerState() val monthPickerState = rememberPickerState() - val startYearIndex = years.indexOf("${chosenYear}년").takeIf { it >= 0 } ?: 0 - val startMonthIndex = months.indexOf("${chosenMonth}월").takeIf { it >= 0 } ?: 0 + val startYearIndex = + if (nullDate) yearsWithNull.lastIndex else yearsWithNull.indexOf("${chosenYear ?: "-"}년") + .takeIf { it >= 0 } ?: 0 + val startMonthIndex = + if (nullDate) monthsWithNull.lastIndex else monthsWithNull.indexOf("${chosenMonth ?: "-"}월") + .takeIf { it >= 0 } ?: 0 - LaunchedEffect(chosenYear) { - yearPickerState.selectedItem = "${chosenYear}년" + LaunchedEffect(nullDate, chosenYear) { + yearPickerState.selectedItem = if (nullDate) "-" else "${chosenYear ?: "-"}년" } - LaunchedEffect(chosenMonth) { - monthPickerState.selectedItem = "${chosenMonth}월" + LaunchedEffect(nullDate, chosenMonth) { + monthPickerState.selectedItem = if (nullDate) "-" else "${chosenMonth ?: "-"}월" } Row( @@ -86,20 +95,20 @@ fun YearMonthPicker( DatePicker( modifier = Modifier.weight(1f), pickerState = yearPickerState, - items = years, + items = yearsWithNull, startIndex = startYearIndex, onItemSelected = { year -> - onYearChosen(year.dropLast(1).toInt()) + onYearChosen(if (year == "-년") null else year.dropLast(1).toInt()) } ) Spacer(modifier = Modifier.width(18.dp)) DatePicker( modifier = Modifier.weight(1f), pickerState = monthPickerState, - items = months, + items = monthsWithNull, startIndex = startMonthIndex, onItemSelected = { month -> - onMonthChosen(month.dropLast(1).toInt()) + onMonthChosen(if (month == "-월") null else month.dropLast(1).toInt()) } ) } @@ -121,8 +130,8 @@ fun DatePicker( val scrollState = rememberLazyListState(initialFirstVisibleItemIndex = startIndex) val flingBehavior = rememberSnapFlingBehavior(lazyListState = scrollState) - LaunchedEffect(itemHeightPixel) { - if (itemHeightPixel > 0) scrollState.scrollToItem(startIndex) + LaunchedEffect(itemHeightPixel, startIndex) { + if (itemHeightPixel > 0 && startIndex >= 0) scrollState.scrollToItem(startIndex) } LaunchedEffect(scrollState) { From 8aed3efbedc8583632693f2e9c48a57aef756935 Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Mon, 16 Dec 2024 20:26:23 +0900 Subject: [PATCH 02/19] =?UTF-8?q?[CHORE/#309]=20import=EB=AC=B8=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/src/main/java/com/terning/feature/main/MainScreen.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/feature/main/src/main/java/com/terning/feature/main/MainScreen.kt b/feature/main/src/main/java/com/terning/feature/main/MainScreen.kt index 2f28f4a4..aa91f6c2 100644 --- a/feature/main/src/main/java/com/terning/feature/main/MainScreen.kt +++ b/feature/main/src/main/java/com/terning/feature/main/MainScreen.kt @@ -16,6 +16,7 @@ import androidx.compose.foundation.layout.padding import androidx.compose.material3.Icon import androidx.compose.material3.NavigationBar import androidx.compose.material3.NavigationBarItem +import androidx.compose.material3.NavigationBarItemDefaults import androidx.compose.material3.Scaffold import androidx.compose.material3.SnackbarDuration import androidx.compose.material3.SnackbarHost @@ -294,7 +295,7 @@ private fun MainBottomBar( fontSize = 9.sp ) }, - colors = androidx.compose.material3.NavigationBarItemDefaults + colors = NavigationBarItemDefaults .colors( selectedIconColor = TerningMain, selectedTextColor = TerningMain, From 523b60ad4cf54d64401ebb3b0468739094266725 Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Fri, 20 Dec 2024 06:42:31 +0900 Subject: [PATCH 03/19] =?UTF-8?q?[FEAT/#309]=20=EC=B2=B4=ED=81=AC=EB=B0=95?= =?UTF-8?q?=EC=8A=A4=20=EB=B0=8F=20=EB=8D=B0=EC=9D=B4=ED=8A=B8=ED=94=BC?= =?UTF-8?q?=EC=BB=A4=EC=9D=98=20=EB=85=84=EA=B3=BC=20=EC=9B=94=EC=9D=98=20?= =?UTF-8?q?=EB=8F=85=EB=A6=BD=EC=A0=81=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/HomeFilteringBottomSheet.kt | 50 +++++++++++++------ .../home/component/HomeYearMonthPicker.kt | 34 +++++++------ 2 files changed, 55 insertions(+), 29 deletions(-) diff --git a/feature/home/src/main/java/com/terning/feature/home/component/HomeFilteringBottomSheet.kt b/feature/home/src/main/java/com/terning/feature/home/component/HomeFilteringBottomSheet.kt index f0e22bc5..03c8b573 100644 --- a/feature/home/src/main/java/com/terning/feature/home/component/HomeFilteringBottomSheet.kt +++ b/feature/home/src/main/java/com/terning/feature/home/component/HomeFilteringBottomSheet.kt @@ -1,5 +1,6 @@ package com.terning.feature.home.component +import android.util.Log import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxWidth @@ -8,6 +9,7 @@ import androidx.compose.foundation.layout.wrapContentHeight import androidx.compose.foundation.lazy.grid.GridCells import androidx.compose.foundation.lazy.grid.LazyVerticalGrid import androidx.compose.foundation.lazy.grid.itemsIndexed +import androidx.compose.material3.Checkbox import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.HorizontalDivider import androidx.compose.material3.Text @@ -60,8 +62,10 @@ fun HomeFilteringBottomSheet( ) } - // todo: 삭제 - var nullDate by remember { mutableStateOf(false) } + // todo : 만약 year와 month의 서버통신 값이 null이면 false로 넣기 + var isYearNull by remember { mutableStateOf(false) } + var isMonthNull by remember { mutableStateOf(false) } + var isCheck by remember { mutableStateOf(false) } TerningBasicBottomSheet( content = { @@ -122,14 +126,27 @@ fun HomeFilteringBottomSheet( R.string.change_filter_period_3, ), onButtonClick = { index -> - // todo: 삭제 - nullDate = true currentPeriod = WorkingPeriod.entries[index] }, modifier = Modifier .padding(horizontal = 24.dp), ) + //todo: 추후 삭제 부탁합니다! + Checkbox( + checked = isCheck && isYearNull && isMonthNull, + onCheckedChange = { isChecked -> + if (isChecked) { + isYearNull = true + isMonthNull = true + isCheck = true + } else { + isCheck = false + } + }, + modifier = Modifier.padding(start = 20.dp) + ) + ChangeFilteringTitleText( text = stringResource(id = R.string.change_filter_start_work_title), modifier = Modifier @@ -139,21 +156,26 @@ fun HomeFilteringBottomSheet( // todo: null 처리 제대로 HomeYearMonthPicker( - chosenYear = defaultStartYear ?: Calendar.getInstance().currentYear, - chosenMonth = defaultStartMonth - ?: Calendar.getInstance().currentMonth, - onYearChosen = { - if (it != null) { - currentStartYear = it + chosenYear = if (isYearNull) null else currentStartYear, + chosenMonth = if (isMonthNull) null else currentStartMonth, + onYearChosen = { year, isNull -> + isYearNull = isNull + if (year != null) { + currentStartYear = year } + Log.d("LYB", "Year chosen: $year, isYearNull: $isYearNull") }, - onMonthChosen = { - if (it != null) { - currentStartMonth = it + onMonthChosen = { month, isNull -> + isMonthNull = isNull + if (month != null) { + currentStartMonth = month } + Log.d("LYB", "Month chosen: $month, isMonthNull: $isMonthNull") }, - nullDate = nullDate + isYearNull = isYearNull, + isMonthNull = isMonthNull, ) + RoundButton( style = TerningTheme.typography.button0, paddingVertical = 19.dp, diff --git a/feature/home/src/main/java/com/terning/feature/home/component/HomeYearMonthPicker.kt b/feature/home/src/main/java/com/terning/feature/home/component/HomeYearMonthPicker.kt index 535288b9..06bfd993 100644 --- a/feature/home/src/main/java/com/terning/feature/home/component/HomeYearMonthPicker.kt +++ b/feature/home/src/main/java/com/terning/feature/home/component/HomeYearMonthPicker.kt @@ -1,5 +1,6 @@ package com.terning.feature.home.component +import android.util.Log import androidx.compose.foundation.gestures.snapping.rememberSnapFlingBehavior import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box @@ -54,36 +55,39 @@ class PickerState { @Composable fun rememberPickerState() = remember { PickerState() } - @Composable fun HomeYearMonthPicker( modifier: Modifier = Modifier, chosenYear: Int?, chosenMonth: Int?, - onYearChosen: (Int?) -> Unit, - onMonthChosen: (Int?) -> Unit, - nullDate: Boolean + onYearChosen: (Int?, Boolean) -> Unit, + onMonthChosen: (Int?,Boolean) -> Unit, + isYearNull: Boolean, + isMonthNull : Boolean, ) { - // todo: 변수명 제대로 - val yearsWithNull = if (nullDate) years + "-" else years - val monthsWithNull = if (nullDate) months + "-" else months + // todo: 변수명 바꾸기 + val yearsWithNull = if (isYearNull) years + "-" else years + val monthsWithNull = if (isMonthNull) months + "-" else months val yearPickerState = rememberPickerState() val monthPickerState = rememberPickerState() + Log.d("LYB", yearsWithNull.toString()) + Log.d("LYB", monthsWithNull.toString()) + val startYearIndex = - if (nullDate) yearsWithNull.lastIndex else yearsWithNull.indexOf("${chosenYear ?: "-"}년") + if (isYearNull) yearsWithNull.lastIndex else yearsWithNull.indexOf("${chosenYear ?: "-"}년") .takeIf { it >= 0 } ?: 0 val startMonthIndex = - if (nullDate) monthsWithNull.lastIndex else monthsWithNull.indexOf("${chosenMonth ?: "-"}월") + if (isMonthNull) monthsWithNull.lastIndex else monthsWithNull.indexOf("${chosenMonth ?: "-"}월") .takeIf { it >= 0 } ?: 0 - LaunchedEffect(nullDate, chosenYear) { - yearPickerState.selectedItem = if (nullDate) "-" else "${chosenYear ?: "-"}년" + LaunchedEffect(isYearNull, chosenYear) { + yearPickerState.selectedItem = if (isYearNull) "-" else "${chosenYear ?: "-"}년" } - LaunchedEffect(nullDate, chosenMonth) { - monthPickerState.selectedItem = if (nullDate) "-" else "${chosenMonth ?: "-"}월" + LaunchedEffect(isMonthNull, chosenMonth) { + monthPickerState.selectedItem = if (isMonthNull) "-" else "${chosenMonth ?: "-"}월" } Row( @@ -98,7 +102,7 @@ fun HomeYearMonthPicker( items = yearsWithNull, startIndex = startYearIndex, onItemSelected = { year -> - onYearChosen(if (year == "-년") null else year.dropLast(1).toInt()) + onYearChosen(if (year == "-") null else year.dropLast(1).toInt(), year == "-") } ) Spacer(modifier = Modifier.width(18.dp)) @@ -108,7 +112,7 @@ fun HomeYearMonthPicker( items = monthsWithNull, startIndex = startMonthIndex, onItemSelected = { month -> - onMonthChosen(if (month == "-월") null else month.dropLast(1).toInt()) + onMonthChosen(if (month == "-") null else month.dropLast(1).toInt(), month == "-") } ) } From 39f647b8130b56b77478b1b03666f46e8e583f31 Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Fri, 20 Dec 2024 07:24:23 +0900 Subject: [PATCH 04/19] =?UTF-8?q?[FEAT/#309]=20=EB=B0=94=EB=80=90=20?= =?UTF-8?q?=EA=B0=92=EC=9D=84=20=EC=9B=90=EB=9E=98=EC=9D=98=20=EA=B0=92?= =?UTF-8?q?=EC=9C=BC=EB=A1=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../feature/home/component/HomeFilteringBottomSheet.kt | 4 ++-- .../com/terning/feature/home/component/HomeYearMonthPicker.kt | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/feature/home/src/main/java/com/terning/feature/home/component/HomeFilteringBottomSheet.kt b/feature/home/src/main/java/com/terning/feature/home/component/HomeFilteringBottomSheet.kt index 03c8b573..d0b5522a 100644 --- a/feature/home/src/main/java/com/terning/feature/home/component/HomeFilteringBottomSheet.kt +++ b/feature/home/src/main/java/com/terning/feature/home/component/HomeFilteringBottomSheet.kt @@ -156,8 +156,8 @@ fun HomeFilteringBottomSheet( // todo: null 처리 제대로 HomeYearMonthPicker( - chosenYear = if (isYearNull) null else currentStartYear, - chosenMonth = if (isMonthNull) null else currentStartMonth, + chosenYear = defaultStartYear ?: Calendar.getInstance().currentYear, + chosenMonth = defaultStartMonth ?: Calendar.getInstance().currentMonth, onYearChosen = { year, isNull -> isYearNull = isNull if (year != null) { diff --git a/feature/home/src/main/java/com/terning/feature/home/component/HomeYearMonthPicker.kt b/feature/home/src/main/java/com/terning/feature/home/component/HomeYearMonthPicker.kt index 06bfd993..6ba8a821 100644 --- a/feature/home/src/main/java/com/terning/feature/home/component/HomeYearMonthPicker.kt +++ b/feature/home/src/main/java/com/terning/feature/home/component/HomeYearMonthPicker.kt @@ -55,6 +55,7 @@ class PickerState { @Composable fun rememberPickerState() = remember { PickerState() } + @Composable fun HomeYearMonthPicker( modifier: Modifier = Modifier, From 23f2f6a84799ac7869fd3ee6f13413029a15ee30 Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Sat, 21 Dec 2024 02:09:08 +0900 Subject: [PATCH 05/19] =?UTF-8?q?[FEAT/#309]=20=EB=8D=B0=EC=9D=B4=ED=8A=B8?= =?UTF-8?q?=ED=94=BC=EC=BB=A4=20=EB=AA=85=EC=84=B8=EC=84=9C=EB=8C=80?= =?UTF-8?q?=EB=A1=9C=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/HomeFilteringBottomSheet.kt | 60 +++++++++++----- .../home/component/HomeYearMonthPicker.kt | 71 ++++++++++++------- 2 files changed, 89 insertions(+), 42 deletions(-) diff --git a/feature/home/src/main/java/com/terning/feature/home/component/HomeFilteringBottomSheet.kt b/feature/home/src/main/java/com/terning/feature/home/component/HomeFilteringBottomSheet.kt index d0b5522a..7cc4fa1e 100644 --- a/feature/home/src/main/java/com/terning/feature/home/component/HomeFilteringBottomSheet.kt +++ b/feature/home/src/main/java/com/terning/feature/home/component/HomeFilteringBottomSheet.kt @@ -19,6 +19,7 @@ import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableIntStateOf import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember +import androidx.compose.runtime.saveable.rememberSaveable import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource @@ -34,6 +35,10 @@ import com.terning.core.designsystem.theme.Grey200 import com.terning.core.designsystem.theme.TerningTheme import com.terning.core.designsystem.type.Grade import com.terning.core.designsystem.type.WorkingPeriod +import com.terning.core.designsystem.util.CalendarDefaults.END_MONTH +import com.terning.core.designsystem.util.CalendarDefaults.END_YEAR +import com.terning.core.designsystem.util.CalendarDefaults.START_MONTH +import com.terning.core.designsystem.util.CalendarDefaults.START_YEAR import java.util.Calendar @OptIn(ExperimentalMaterial3Api::class) @@ -65,8 +70,11 @@ fun HomeFilteringBottomSheet( // todo : 만약 year와 month의 서버통신 값이 null이면 false로 넣기 var isYearNull by remember { mutableStateOf(false) } var isMonthNull by remember { mutableStateOf(false) } + // todo: year와 month의 서버통신 값이 null이면 true로 넣기 var isCheck by remember { mutableStateOf(false) } + var isFirstNullAndFirstChange by remember { mutableStateOf(false) } + TerningBasicBottomSheet( content = { Column( @@ -132,9 +140,32 @@ fun HomeFilteringBottomSheet( .padding(horizontal = 24.dp), ) + ChangeFilteringTitleText( + text = stringResource(id = R.string.change_filter_start_work_title), + modifier = Modifier + .padding(top = 32.dp, bottom = 49.dp) + .padding(horizontal = 24.dp) + ) + + val years = (START_YEAR..END_YEAR).map { "${it}년" } + val months = (START_MONTH..END_MONTH).map { "${it}월" } + + val yearsWithNull by remember(isYearNull) { + mutableStateOf( + if (isYearNull || isFirstNullAndFirstChange) years + "-" + else years + ) + } + val monthsWithNull by remember(isMonthNull) { + mutableStateOf( + if (isMonthNull || isFirstNullAndFirstChange) months + "-" + else months + ) + } + //todo: 추후 삭제 부탁합니다! Checkbox( - checked = isCheck && isYearNull && isMonthNull, + checked = isCheck, onCheckedChange = { isChecked -> if (isChecked) { isYearNull = true @@ -147,33 +178,31 @@ fun HomeFilteringBottomSheet( modifier = Modifier.padding(start = 20.dp) ) - ChangeFilteringTitleText( - text = stringResource(id = R.string.change_filter_start_work_title), - modifier = Modifier - .padding(top = 32.dp, bottom = 49.dp) - .padding(horizontal = 24.dp) - ) - - // todo: null 처리 제대로 + // todo: null 처리 제대로 HomeYearMonthPicker( chosenYear = defaultStartYear ?: Calendar.getInstance().currentYear, chosenMonth = defaultStartMonth ?: Calendar.getInstance().currentMonth, - onYearChosen = { year, isNull -> - isYearNull = isNull + onYearChosen = { year, isNull, isFirst -> if (year != null) { currentStartYear = year + isCheck = false + isYearNull = false + isFirstNullAndFirstChange = isFirst } - Log.d("LYB", "Year chosen: $year, isYearNull: $isYearNull") }, - onMonthChosen = { month, isNull -> - isMonthNull = isNull + onMonthChosen = { month, isNull, isFirst -> if (month != null) { currentStartMonth = month + isCheck = false + isMonthNull = false + isFirstNullAndFirstChange = isFirst } - Log.d("LYB", "Month chosen: $month, isMonthNull: $isMonthNull") }, isYearNull = isYearNull, isMonthNull = isMonthNull, + years = yearsWithNull, + months = monthsWithNull, + isFirstNullAndFirstChange = isFirstNullAndFirstChange ) RoundButton( @@ -199,7 +228,6 @@ fun HomeFilteringBottomSheet( isEnabled = currentGrade != null && currentPeriod != null ) } - }, onDismissRequest = onDismiss, sheetState = sheetState, diff --git a/feature/home/src/main/java/com/terning/feature/home/component/HomeYearMonthPicker.kt b/feature/home/src/main/java/com/terning/feature/home/component/HomeYearMonthPicker.kt index 6ba8a821..6063f1a0 100644 --- a/feature/home/src/main/java/com/terning/feature/home/component/HomeYearMonthPicker.kt +++ b/feature/home/src/main/java/com/terning/feature/home/component/HomeYearMonthPicker.kt @@ -61,34 +61,31 @@ fun HomeYearMonthPicker( modifier: Modifier = Modifier, chosenYear: Int?, chosenMonth: Int?, - onYearChosen: (Int?, Boolean) -> Unit, - onMonthChosen: (Int?,Boolean) -> Unit, + onYearChosen: (Int?, Boolean, Boolean) -> Unit, + onMonthChosen: (Int?, Boolean, Boolean) -> Unit, isYearNull: Boolean, - isMonthNull : Boolean, + isMonthNull: Boolean, + years: List, + months: List, + isFirstNullAndFirstChange: Boolean ) { // todo: 변수명 바꾸기 - val yearsWithNull = if (isYearNull) years + "-" else years - val monthsWithNull = if (isMonthNull) months + "-" else months +// val yearsWithNull = if (isYearNull) years + "-" else years +// val monthsWithNull = if (isMonthNull) months + "-" else months val yearPickerState = rememberPickerState() val monthPickerState = rememberPickerState() - Log.d("LYB", yearsWithNull.toString()) - Log.d("LYB", monthsWithNull.toString()) + var isFirst = isFirstNullAndFirstChange - val startYearIndex = - if (isYearNull) yearsWithNull.lastIndex else yearsWithNull.indexOf("${chosenYear ?: "-"}년") - .takeIf { it >= 0 } ?: 0 - val startMonthIndex = - if (isMonthNull) monthsWithNull.lastIndex else monthsWithNull.indexOf("${chosenMonth ?: "-"}월") - .takeIf { it >= 0 } ?: 0 - - LaunchedEffect(isYearNull, chosenYear) { - yearPickerState.selectedItem = if (isYearNull) "-" else "${chosenYear ?: "-"}년" - } + val startYearIndex = remember(isYearNull) { + if (isYearNull) years.lastIndex else years.indexOf("${chosenYear ?: "-"}년") + .takeIf { it >= 0 } ?: 0 + } - LaunchedEffect(isMonthNull, chosenMonth) { - monthPickerState.selectedItem = if (isMonthNull) "-" else "${chosenMonth ?: "-"}월" + val startMonthIndex = remember(isMonthNull) { + if (isMonthNull) months.lastIndex else months.indexOf("${chosenMonth ?: "-"}월") + .takeIf { it >= 0 } ?: 0 } Row( @@ -100,20 +97,30 @@ fun HomeYearMonthPicker( DatePicker( modifier = Modifier.weight(1f), pickerState = yearPickerState, - items = yearsWithNull, + items = years, startIndex = startYearIndex, onItemSelected = { year -> - onYearChosen(if (year == "-") null else year.dropLast(1).toInt(), year == "-") + if (year == "-" && !isFirst) isFirst = true + onYearChosen( + if (year == "-") null else year.dropLast(1).toInt(), + year == "-", + isFirst + ) } ) Spacer(modifier = Modifier.width(18.dp)) DatePicker( modifier = Modifier.weight(1f), pickerState = monthPickerState, - items = monthsWithNull, + items = months, startIndex = startMonthIndex, onItemSelected = { month -> - onMonthChosen(if (month == "-") null else month.dropLast(1).toInt(), month == "-") + if (month == "-" && !isFirst) isFirst = true + onMonthChosen( + if (month == "-") null else month.dropLast(1).toInt(), + month == "-", + isFirst + ) } ) } @@ -136,17 +143,28 @@ fun DatePicker( val flingBehavior = rememberSnapFlingBehavior(lazyListState = scrollState) LaunchedEffect(itemHeightPixel, startIndex) { - if (itemHeightPixel > 0 && startIndex >= 0) scrollState.scrollToItem(startIndex) + if (itemHeightPixel > 0 && startIndex >= 0) { + scrollState.scrollToItem(startIndex) + } } + // todo: type safety 하게 수정 필요 && 변수명도 수정 + val isNullSize = items.size == 12 || items.size == 21 + LaunchedEffect(scrollState) { snapshotFlow { scrollState.firstVisibleItemIndex } - .map { index -> items.getOrNull(index) } + .map { index -> + var newItem = items + if (isNullSize) newItem = items + "-" + Log.d("PickerDebug", "Index: $index, Item: ${newItem.getOrNull(index)}") + newItem.getOrNull(index) + } .distinctUntilChanged() .collect { item -> item?.let { pickerState.selectedItem = it onItemSelected(it) + Log.d("PickerDebug", "Selected Item: $it") } } } @@ -166,11 +184,12 @@ fun DatePicker( Spacer(modifier = Modifier.height(itemHeightDp)) } items(items.size) { index -> + val isSelected = pickerState.selectedItem == items[index] DatePickerContent( modifier = Modifier .onSizeChanged { intSize: IntSize -> itemHeightPixel = intSize.height }, text = items[index], - color = if (pickerState.selectedItem == items[index]) Grey500 else Grey300 + color = if (isSelected) Grey500 else Grey300 ) } items(visibleItemsMiddle) { From 81e07694f4b1256514e071f95550d369330607f5 Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Sat, 21 Dec 2024 02:29:51 +0900 Subject: [PATCH 06/19] =?UTF-8?q?[DEL/#309]=20=EB=A1=9C=EA=B7=B8=20?= =?UTF-8?q?=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/HomeFilteringBottomSheet.kt | 24 +++++++------------ .../home/component/HomeYearMonthPicker.kt | 19 ++++----------- 2 files changed, 13 insertions(+), 30 deletions(-) diff --git a/feature/home/src/main/java/com/terning/feature/home/component/HomeFilteringBottomSheet.kt b/feature/home/src/main/java/com/terning/feature/home/component/HomeFilteringBottomSheet.kt index 7cc4fa1e..9ba7907d 100644 --- a/feature/home/src/main/java/com/terning/feature/home/component/HomeFilteringBottomSheet.kt +++ b/feature/home/src/main/java/com/terning/feature/home/component/HomeFilteringBottomSheet.kt @@ -1,6 +1,5 @@ package com.terning.feature.home.component -import android.util.Log import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxWidth @@ -19,7 +18,6 @@ import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableIntStateOf import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember -import androidx.compose.runtime.saveable.rememberSaveable import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource @@ -35,10 +33,6 @@ import com.terning.core.designsystem.theme.Grey200 import com.terning.core.designsystem.theme.TerningTheme import com.terning.core.designsystem.type.Grade import com.terning.core.designsystem.type.WorkingPeriod -import com.terning.core.designsystem.util.CalendarDefaults.END_MONTH -import com.terning.core.designsystem.util.CalendarDefaults.END_YEAR -import com.terning.core.designsystem.util.CalendarDefaults.START_MONTH -import com.terning.core.designsystem.util.CalendarDefaults.START_YEAR import java.util.Calendar @OptIn(ExperimentalMaterial3Api::class) @@ -67,14 +61,6 @@ fun HomeFilteringBottomSheet( ) } - // todo : 만약 year와 month의 서버통신 값이 null이면 false로 넣기 - var isYearNull by remember { mutableStateOf(false) } - var isMonthNull by remember { mutableStateOf(false) } - // todo: year와 month의 서버통신 값이 null이면 true로 넣기 - var isCheck by remember { mutableStateOf(false) } - - var isFirstNullAndFirstChange by remember { mutableStateOf(false) } - TerningBasicBottomSheet( content = { Column( @@ -147,9 +133,15 @@ fun HomeFilteringBottomSheet( .padding(horizontal = 24.dp) ) - val years = (START_YEAR..END_YEAR).map { "${it}년" } - val months = (START_MONTH..END_MONTH).map { "${it}월" } + // todo : 만약 year와 month의 서버통신 값이 null이면 false로 넣기 + var isYearNull by remember { mutableStateOf(false) } + var isMonthNull by remember { mutableStateOf(false) } + // todo: year와 month의 서버통신 값이 null이면 true로 넣기 + var isCheck by remember { mutableStateOf(false) } + + var isFirstNullAndFirstChange by remember { mutableStateOf(false) } + // todo: 변수명 바꾸기 val yearsWithNull by remember(isYearNull) { mutableStateOf( if (isYearNull || isFirstNullAndFirstChange) years + "-" diff --git a/feature/home/src/main/java/com/terning/feature/home/component/HomeYearMonthPicker.kt b/feature/home/src/main/java/com/terning/feature/home/component/HomeYearMonthPicker.kt index 6063f1a0..14d0679b 100644 --- a/feature/home/src/main/java/com/terning/feature/home/component/HomeYearMonthPicker.kt +++ b/feature/home/src/main/java/com/terning/feature/home/component/HomeYearMonthPicker.kt @@ -1,6 +1,5 @@ package com.terning.feature.home.component -import android.util.Log import androidx.compose.foundation.gestures.snapping.rememberSnapFlingBehavior import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box @@ -43,11 +42,9 @@ import kotlinx.coroutines.flow.distinctUntilChanged import kotlinx.coroutines.flow.map import okhttp3.internal.toImmutableList -private val years = - (START_YEAR..END_YEAR).map { "${it}년" }.toImmutableList() +val years = (START_YEAR..END_YEAR).map { "${it}년" }.toImmutableList() -private val months = - (START_MONTH..END_MONTH).map { "${it}월" }.toImmutableList() +val months = (START_MONTH..END_MONTH).map { "${it}월" }.toImmutableList() class PickerState { var selectedItem by mutableStateOf("") @@ -69,19 +66,15 @@ fun HomeYearMonthPicker( months: List, isFirstNullAndFirstChange: Boolean ) { - // todo: 변수명 바꾸기 -// val yearsWithNull = if (isYearNull) years + "-" else years -// val monthsWithNull = if (isMonthNull) months + "-" else months - val yearPickerState = rememberPickerState() val monthPickerState = rememberPickerState() var isFirst = isFirstNullAndFirstChange val startYearIndex = remember(isYearNull) { - if (isYearNull) years.lastIndex else years.indexOf("${chosenYear ?: "-"}년") - .takeIf { it >= 0 } ?: 0 - } + if (isYearNull) years.lastIndex else years.indexOf("${chosenYear ?: "-"}년") + .takeIf { it >= 0 } ?: 0 + } val startMonthIndex = remember(isMonthNull) { if (isMonthNull) months.lastIndex else months.indexOf("${chosenMonth ?: "-"}월") @@ -156,7 +149,6 @@ fun DatePicker( .map { index -> var newItem = items if (isNullSize) newItem = items + "-" - Log.d("PickerDebug", "Index: $index, Item: ${newItem.getOrNull(index)}") newItem.getOrNull(index) } .distinctUntilChanged() @@ -164,7 +156,6 @@ fun DatePicker( item?.let { pickerState.selectedItem = it onItemSelected(it) - Log.d("PickerDebug", "Selected Item: $it") } } } From 5ea0e4b83017934ffd97f6863369b71634bc0420 Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Sat, 21 Dec 2024 02:38:13 +0900 Subject: [PATCH 07/19] =?UTF-8?q?[DEL/#309]=20=EB=B6=88=ED=95=84=EC=9A=94?= =?UTF-8?q?=ED=95=9C=20remember=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../terning/feature/home/component/HomeYearMonthPicker.kt | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/feature/home/src/main/java/com/terning/feature/home/component/HomeYearMonthPicker.kt b/feature/home/src/main/java/com/terning/feature/home/component/HomeYearMonthPicker.kt index 14d0679b..368fe5a0 100644 --- a/feature/home/src/main/java/com/terning/feature/home/component/HomeYearMonthPicker.kt +++ b/feature/home/src/main/java/com/terning/feature/home/component/HomeYearMonthPicker.kt @@ -71,15 +71,13 @@ fun HomeYearMonthPicker( var isFirst = isFirstNullAndFirstChange - val startYearIndex = remember(isYearNull) { + val startYearIndex = if (isYearNull) years.lastIndex else years.indexOf("${chosenYear ?: "-"}년") - .takeIf { it >= 0 } ?: 0 - } + .takeIf { it >= 0 } ?: 0 - val startMonthIndex = remember(isMonthNull) { + val startMonthIndex = if (isMonthNull) months.lastIndex else months.indexOf("${chosenMonth ?: "-"}월") .takeIf { it >= 0 } ?: 0 - } Row( modifier = modifier From 24d3ccdb3266decc52cf39b1663d79ee11c8a218 Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Sat, 21 Dec 2024 02:40:15 +0900 Subject: [PATCH 08/19] =?UTF-8?q?[DEL/#309]=20=EB=B6=88=ED=95=84=EC=9A=94?= =?UTF-8?q?=ED=95=9C=20=EB=A7=A4=EA=B0=9C=EB=B3=80=EC=88=98=20=EC=A0=9C?= =?UTF-8?q?=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../home/component/HomeFilteringBottomSheet.kt | 4 ++-- .../home/component/HomeYearMonthPicker.kt | 16 ++++------------ 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/feature/home/src/main/java/com/terning/feature/home/component/HomeFilteringBottomSheet.kt b/feature/home/src/main/java/com/terning/feature/home/component/HomeFilteringBottomSheet.kt index 9ba7907d..e32abf55 100644 --- a/feature/home/src/main/java/com/terning/feature/home/component/HomeFilteringBottomSheet.kt +++ b/feature/home/src/main/java/com/terning/feature/home/component/HomeFilteringBottomSheet.kt @@ -174,7 +174,7 @@ fun HomeFilteringBottomSheet( HomeYearMonthPicker( chosenYear = defaultStartYear ?: Calendar.getInstance().currentYear, chosenMonth = defaultStartMonth ?: Calendar.getInstance().currentMonth, - onYearChosen = { year, isNull, isFirst -> + onYearChosen = { year, isFirst -> if (year != null) { currentStartYear = year isCheck = false @@ -182,7 +182,7 @@ fun HomeFilteringBottomSheet( isFirstNullAndFirstChange = isFirst } }, - onMonthChosen = { month, isNull, isFirst -> + onMonthChosen = { month, isFirst -> if (month != null) { currentStartMonth = month isCheck = false diff --git a/feature/home/src/main/java/com/terning/feature/home/component/HomeYearMonthPicker.kt b/feature/home/src/main/java/com/terning/feature/home/component/HomeYearMonthPicker.kt index 368fe5a0..a5a3a28b 100644 --- a/feature/home/src/main/java/com/terning/feature/home/component/HomeYearMonthPicker.kt +++ b/feature/home/src/main/java/com/terning/feature/home/component/HomeYearMonthPicker.kt @@ -58,8 +58,8 @@ fun HomeYearMonthPicker( modifier: Modifier = Modifier, chosenYear: Int?, chosenMonth: Int?, - onYearChosen: (Int?, Boolean, Boolean) -> Unit, - onMonthChosen: (Int?, Boolean, Boolean) -> Unit, + onYearChosen: (Int?, Boolean) -> Unit, + onMonthChosen: (Int?, Boolean) -> Unit, isYearNull: Boolean, isMonthNull: Boolean, years: List, @@ -92,11 +92,7 @@ fun HomeYearMonthPicker( startIndex = startYearIndex, onItemSelected = { year -> if (year == "-" && !isFirst) isFirst = true - onYearChosen( - if (year == "-") null else year.dropLast(1).toInt(), - year == "-", - isFirst - ) + onYearChosen(if (year == "-") null else year.dropLast(1).toInt(), isFirst) } ) Spacer(modifier = Modifier.width(18.dp)) @@ -107,11 +103,7 @@ fun HomeYearMonthPicker( startIndex = startMonthIndex, onItemSelected = { month -> if (month == "-" && !isFirst) isFirst = true - onMonthChosen( - if (month == "-") null else month.dropLast(1).toInt(), - month == "-", - isFirst - ) + onMonthChosen(if (month == "-") null else month.dropLast(1).toInt(), isFirst) } ) } From d68a2eb871bc53ed664831cb5a406a3593205410 Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Sat, 21 Dec 2024 02:48:11 +0900 Subject: [PATCH 09/19] =?UTF-8?q?[MOD/#309]=20=EB=B3=80=EC=88=98=EB=AA=85?= =?UTF-8?q?=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/HomeFilteringBottomSheet.kt | 49 +++++++++---------- .../home/component/HomeYearMonthPicker.kt | 12 ++--- 2 files changed, 30 insertions(+), 31 deletions(-) diff --git a/feature/home/src/main/java/com/terning/feature/home/component/HomeFilteringBottomSheet.kt b/feature/home/src/main/java/com/terning/feature/home/component/HomeFilteringBottomSheet.kt index e32abf55..aa3ee2cf 100644 --- a/feature/home/src/main/java/com/terning/feature/home/component/HomeFilteringBottomSheet.kt +++ b/feature/home/src/main/java/com/terning/feature/home/component/HomeFilteringBottomSheet.kt @@ -61,6 +61,27 @@ fun HomeFilteringBottomSheet( ) } + // todo : year와 month의 서버통신 값이 null이면 각각 false로 넣어주세요! + var isYearNull by remember { mutableStateOf(false) } + var isMonthNull by remember { mutableStateOf(false) } + // todo: year와 month의 서버통신 값이 null이면 true로 넣어주세요! + var isCheck by remember { mutableStateOf(false) } + + var isFirstNullAndFirstChange by remember { mutableStateOf(false) } + + val yearsList by remember(isYearNull) { + mutableStateOf( + if (isYearNull || isFirstNullAndFirstChange) years + "-" + else years + ) + } + val monthsList by remember(isMonthNull) { + mutableStateOf( + if (isMonthNull || isFirstNullAndFirstChange) months + "-" + else months + ) + } + TerningBasicBottomSheet( content = { Column( @@ -133,29 +154,7 @@ fun HomeFilteringBottomSheet( .padding(horizontal = 24.dp) ) - // todo : 만약 year와 month의 서버통신 값이 null이면 false로 넣기 - var isYearNull by remember { mutableStateOf(false) } - var isMonthNull by remember { mutableStateOf(false) } - // todo: year와 month의 서버통신 값이 null이면 true로 넣기 - var isCheck by remember { mutableStateOf(false) } - - var isFirstNullAndFirstChange by remember { mutableStateOf(false) } - - // todo: 변수명 바꾸기 - val yearsWithNull by remember(isYearNull) { - mutableStateOf( - if (isYearNull || isFirstNullAndFirstChange) years + "-" - else years - ) - } - val monthsWithNull by remember(isMonthNull) { - mutableStateOf( - if (isMonthNull || isFirstNullAndFirstChange) months + "-" - else months - ) - } - - //todo: 추후 삭제 부탁합니다! + //todo: 예시 체크박스로, 추후 수정 부탁합니다! Checkbox( checked = isCheck, onCheckedChange = { isChecked -> @@ -192,8 +191,8 @@ fun HomeFilteringBottomSheet( }, isYearNull = isYearNull, isMonthNull = isMonthNull, - years = yearsWithNull, - months = monthsWithNull, + yearsList = yearsList, + monthsList = monthsList, isFirstNullAndFirstChange = isFirstNullAndFirstChange ) diff --git a/feature/home/src/main/java/com/terning/feature/home/component/HomeYearMonthPicker.kt b/feature/home/src/main/java/com/terning/feature/home/component/HomeYearMonthPicker.kt index a5a3a28b..82f09556 100644 --- a/feature/home/src/main/java/com/terning/feature/home/component/HomeYearMonthPicker.kt +++ b/feature/home/src/main/java/com/terning/feature/home/component/HomeYearMonthPicker.kt @@ -62,8 +62,8 @@ fun HomeYearMonthPicker( onMonthChosen: (Int?, Boolean) -> Unit, isYearNull: Boolean, isMonthNull: Boolean, - years: List, - months: List, + yearsList: List, + monthsList: List, isFirstNullAndFirstChange: Boolean ) { val yearPickerState = rememberPickerState() @@ -72,11 +72,11 @@ fun HomeYearMonthPicker( var isFirst = isFirstNullAndFirstChange val startYearIndex = - if (isYearNull) years.lastIndex else years.indexOf("${chosenYear ?: "-"}년") + if (isYearNull) yearsList.lastIndex else yearsList.indexOf("${chosenYear ?: "-"}년") .takeIf { it >= 0 } ?: 0 val startMonthIndex = - if (isMonthNull) months.lastIndex else months.indexOf("${chosenMonth ?: "-"}월") + if (isMonthNull) monthsList.lastIndex else monthsList.indexOf("${chosenMonth ?: "-"}월") .takeIf { it >= 0 } ?: 0 Row( @@ -88,7 +88,7 @@ fun HomeYearMonthPicker( DatePicker( modifier = Modifier.weight(1f), pickerState = yearPickerState, - items = years, + items = yearsList, startIndex = startYearIndex, onItemSelected = { year -> if (year == "-" && !isFirst) isFirst = true @@ -99,7 +99,7 @@ fun HomeYearMonthPicker( DatePicker( modifier = Modifier.weight(1f), pickerState = monthPickerState, - items = months, + items = monthsList, startIndex = startMonthIndex, onItemSelected = { month -> if (month == "-" && !isFirst) isFirst = true From 42229352554ffe73ef9a64e825efe0777a406785 Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Sat, 21 Dec 2024 02:53:31 +0900 Subject: [PATCH 10/19] =?UTF-8?q?[MOD/#309]=20=EC=B2=B4=ED=81=AC=EB=B0=95?= =?UTF-8?q?=EC=8A=A4=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 --- .../home/component/HomeFilteringBottomSheet.kt | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/feature/home/src/main/java/com/terning/feature/home/component/HomeFilteringBottomSheet.kt b/feature/home/src/main/java/com/terning/feature/home/component/HomeFilteringBottomSheet.kt index aa3ee2cf..adc3b367 100644 --- a/feature/home/src/main/java/com/terning/feature/home/component/HomeFilteringBottomSheet.kt +++ b/feature/home/src/main/java/com/terning/feature/home/component/HomeFilteringBottomSheet.kt @@ -65,7 +65,7 @@ fun HomeFilteringBottomSheet( var isYearNull by remember { mutableStateOf(false) } var isMonthNull by remember { mutableStateOf(false) } // todo: year와 month의 서버통신 값이 null이면 true로 넣어주세요! - var isCheck by remember { mutableStateOf(false) } + var isCheckBoxChecked by remember { mutableStateOf(false) } var isFirstNullAndFirstChange by remember { mutableStateOf(false) } @@ -154,17 +154,15 @@ fun HomeFilteringBottomSheet( .padding(horizontal = 24.dp) ) - //todo: 예시 체크박스로, 추후 수정 부탁합니다! + //todo: 아래는 예시 체크박스로, 추후 수정 부탁합니다! Checkbox( - checked = isCheck, + checked = isCheckBoxChecked, onCheckedChange = { isChecked -> if (isChecked) { isYearNull = true isMonthNull = true - isCheck = true - } else { - isCheck = false } + isCheckBoxChecked = isChecked }, modifier = Modifier.padding(start = 20.dp) ) @@ -176,7 +174,7 @@ fun HomeFilteringBottomSheet( onYearChosen = { year, isFirst -> if (year != null) { currentStartYear = year - isCheck = false + isCheckBoxChecked = false isYearNull = false isFirstNullAndFirstChange = isFirst } @@ -184,7 +182,7 @@ fun HomeFilteringBottomSheet( onMonthChosen = { month, isFirst -> if (month != null) { currentStartMonth = month - isCheck = false + isCheckBoxChecked = false isMonthNull = false isFirstNullAndFirstChange = isFirst } From 26a9bb55befaf8bd3090d5e5ec94b2eaccb6ba73 Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Sat, 21 Dec 2024 03:05:47 +0900 Subject: [PATCH 11/19] =?UTF-8?q?[MOD/#309]=20=EB=B3=80=EC=88=98=EB=AA=85?= =?UTF-8?q?=20=EC=88=98=EC=A0=95=20=EB=B0=8F=20NULL=5FDATE=20=EC=83=81?= =?UTF-8?q?=EC=88=98=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/HomeFilteringBottomSheet.kt | 17 +++++++------ .../home/component/HomeYearMonthPicker.kt | 24 ++++++++++++------- 2 files changed, 24 insertions(+), 17 deletions(-) diff --git a/feature/home/src/main/java/com/terning/feature/home/component/HomeFilteringBottomSheet.kt b/feature/home/src/main/java/com/terning/feature/home/component/HomeFilteringBottomSheet.kt index adc3b367..80c21ac8 100644 --- a/feature/home/src/main/java/com/terning/feature/home/component/HomeFilteringBottomSheet.kt +++ b/feature/home/src/main/java/com/terning/feature/home/component/HomeFilteringBottomSheet.kt @@ -67,17 +67,17 @@ fun HomeFilteringBottomSheet( // todo: year와 month의 서버통신 값이 null이면 true로 넣어주세요! var isCheckBoxChecked by remember { mutableStateOf(false) } - var isFirstNullAndFirstChange by remember { mutableStateOf(false) } + var isInitialNullState by remember { mutableStateOf(false) } val yearsList by remember(isYearNull) { mutableStateOf( - if (isYearNull || isFirstNullAndFirstChange) years + "-" + if (isYearNull || isInitialNullState) years + NULL_DATE else years ) } val monthsList by remember(isMonthNull) { mutableStateOf( - if (isMonthNull || isFirstNullAndFirstChange) months + "-" + if (isMonthNull || isInitialNullState) months + NULL_DATE else months ) } @@ -167,31 +167,30 @@ fun HomeFilteringBottomSheet( modifier = Modifier.padding(start = 20.dp) ) - // todo: null 처리 제대로 HomeYearMonthPicker( chosenYear = defaultStartYear ?: Calendar.getInstance().currentYear, chosenMonth = defaultStartMonth ?: Calendar.getInstance().currentMonth, - onYearChosen = { year, isFirst -> + onYearChosen = { year, isInitialSelection -> if (year != null) { currentStartYear = year isCheckBoxChecked = false isYearNull = false - isFirstNullAndFirstChange = isFirst + isInitialNullState = isInitialSelection } }, - onMonthChosen = { month, isFirst -> + onMonthChosen = { month, isInitialSelection -> if (month != null) { currentStartMonth = month isCheckBoxChecked = false isMonthNull = false - isFirstNullAndFirstChange = isFirst + isInitialNullState = isInitialSelection } }, isYearNull = isYearNull, isMonthNull = isMonthNull, yearsList = yearsList, monthsList = monthsList, - isFirstNullAndFirstChange = isFirstNullAndFirstChange + isInitialNullState = isInitialNullState ) RoundButton( diff --git a/feature/home/src/main/java/com/terning/feature/home/component/HomeYearMonthPicker.kt b/feature/home/src/main/java/com/terning/feature/home/component/HomeYearMonthPicker.kt index 82f09556..7bc0d38f 100644 --- a/feature/home/src/main/java/com/terning/feature/home/component/HomeYearMonthPicker.kt +++ b/feature/home/src/main/java/com/terning/feature/home/component/HomeYearMonthPicker.kt @@ -46,6 +46,8 @@ val years = (START_YEAR..END_YEAR).map { "${it}년" }.toImmutableList() val months = (START_MONTH..END_MONTH).map { "${it}월" }.toImmutableList() +const val NULL_DATE = "-" + class PickerState { var selectedItem by mutableStateOf("") } @@ -64,16 +66,16 @@ fun HomeYearMonthPicker( isMonthNull: Boolean, yearsList: List, monthsList: List, - isFirstNullAndFirstChange: Boolean + isInitialNullState: Boolean ) { val yearPickerState = rememberPickerState() val monthPickerState = rememberPickerState() - var isFirst = isFirstNullAndFirstChange + var isInitialSelection by remember { mutableStateOf(isInitialNullState) } val startYearIndex = if (isYearNull) yearsList.lastIndex else yearsList.indexOf("${chosenYear ?: "-"}년") - .takeIf { it >= 0 } ?: 0 + .takeIf { it >= 0 } ?: 0 val startMonthIndex = if (isMonthNull) monthsList.lastIndex else monthsList.indexOf("${chosenMonth ?: "-"}월") @@ -91,8 +93,11 @@ fun HomeYearMonthPicker( items = yearsList, startIndex = startYearIndex, onItemSelected = { year -> - if (year == "-" && !isFirst) isFirst = true - onYearChosen(if (year == "-") null else year.dropLast(1).toInt(), isFirst) + if (year == NULL_DATE && !isInitialSelection) isInitialSelection = true + onYearChosen( + if (year == NULL_DATE) null else year.dropLast(1).toInt(), + isInitialSelection + ) } ) Spacer(modifier = Modifier.width(18.dp)) @@ -102,8 +107,11 @@ fun HomeYearMonthPicker( items = monthsList, startIndex = startMonthIndex, onItemSelected = { month -> - if (month == "-" && !isFirst) isFirst = true - onMonthChosen(if (month == "-") null else month.dropLast(1).toInt(), isFirst) + if (month == NULL_DATE && !isInitialSelection) isInitialSelection = true + onMonthChosen( + if (month == NULL_DATE) null else month.dropLast(1).toInt(), + isInitialSelection + ) } ) } @@ -138,7 +146,7 @@ fun DatePicker( snapshotFlow { scrollState.firstVisibleItemIndex } .map { index -> var newItem = items - if (isNullSize) newItem = items + "-" + if (isNullSize) newItem = items + NULL_DATE newItem.getOrNull(index) } .distinctUntilChanged() From 708c457fc2df65308008b9037147e0950e4a43a6 Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Sat, 21 Dec 2024 03:45:47 +0900 Subject: [PATCH 12/19] =?UTF-8?q?[MOD/#309]=20=EC=9B=90=EB=9E=98=EC=9D=98?= =?UTF-8?q?=20=ED=98=95=ED=83=9C=EC=97=90=20=EB=A7=9E=EA=B2=8C=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 --- .../feature/home/component/HomeFilteringBottomSheet.kt | 8 ++++---- .../terning/feature/home/component/HomeYearMonthPicker.kt | 5 +---- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/feature/home/src/main/java/com/terning/feature/home/component/HomeFilteringBottomSheet.kt b/feature/home/src/main/java/com/terning/feature/home/component/HomeFilteringBottomSheet.kt index 80c21ac8..f7fb5456 100644 --- a/feature/home/src/main/java/com/terning/feature/home/component/HomeFilteringBottomSheet.kt +++ b/feature/home/src/main/java/com/terning/feature/home/component/HomeFilteringBottomSheet.kt @@ -61,10 +61,10 @@ fun HomeFilteringBottomSheet( ) } - // todo : year와 month의 서버통신 값이 null이면 각각 false로 넣어주세요! + // todo: 아래 변수의 mutableStateOf 값을 각각 "defaultStartYear != null"로 넣어주세요. var isYearNull by remember { mutableStateOf(false) } var isMonthNull by remember { mutableStateOf(false) } - // todo: year와 month의 서버통신 값이 null이면 true로 넣어주세요! + var isCheckBoxChecked by remember { mutableStateOf(false) } var isInitialNullState by remember { mutableStateOf(false) } @@ -168,8 +168,8 @@ fun HomeFilteringBottomSheet( ) HomeYearMonthPicker( - chosenYear = defaultStartYear ?: Calendar.getInstance().currentYear, - chosenMonth = defaultStartMonth ?: Calendar.getInstance().currentMonth, + chosenYear = defaultStartYear, + chosenMonth = defaultStartMonth, onYearChosen = { year, isInitialSelection -> if (year != null) { currentStartYear = year diff --git a/feature/home/src/main/java/com/terning/feature/home/component/HomeYearMonthPicker.kt b/feature/home/src/main/java/com/terning/feature/home/component/HomeYearMonthPicker.kt index 7bc0d38f..c366247a 100644 --- a/feature/home/src/main/java/com/terning/feature/home/component/HomeYearMonthPicker.kt +++ b/feature/home/src/main/java/com/terning/feature/home/component/HomeYearMonthPicker.kt @@ -94,10 +94,7 @@ fun HomeYearMonthPicker( startIndex = startYearIndex, onItemSelected = { year -> if (year == NULL_DATE && !isInitialSelection) isInitialSelection = true - onYearChosen( - if (year == NULL_DATE) null else year.dropLast(1).toInt(), - isInitialSelection - ) + onYearChosen(if (year == NULL_DATE) null else year.dropLast(1).toInt(), isInitialSelection) } ) Spacer(modifier = Modifier.width(18.dp)) From 449ae7b34abb5769ee3f8c0bb2647ded7147ba83 Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Sat, 21 Dec 2024 03:59:40 +0900 Subject: [PATCH 13/19] =?UTF-8?q?[MOD/#309]=20=EB=B3=80=EC=88=98=EB=AA=85?= =?UTF-8?q?=20=EB=B0=8F=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 --- .../feature/home/component/HomeYearMonthPicker.kt | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/feature/home/src/main/java/com/terning/feature/home/component/HomeYearMonthPicker.kt b/feature/home/src/main/java/com/terning/feature/home/component/HomeYearMonthPicker.kt index c366247a..0a332753 100644 --- a/feature/home/src/main/java/com/terning/feature/home/component/HomeYearMonthPicker.kt +++ b/feature/home/src/main/java/com/terning/feature/home/component/HomeYearMonthPicker.kt @@ -94,7 +94,10 @@ fun HomeYearMonthPicker( startIndex = startYearIndex, onItemSelected = { year -> if (year == NULL_DATE && !isInitialSelection) isInitialSelection = true - onYearChosen(if (year == NULL_DATE) null else year.dropLast(1).toInt(), isInitialSelection) + onYearChosen( + if (year == NULL_DATE) null else year.dropLast(1).toInt(), + isInitialSelection + ) } ) Spacer(modifier = Modifier.width(18.dp)) @@ -136,15 +139,13 @@ fun DatePicker( } } - // todo: type safety 하게 수정 필요 && 변수명도 수정 - val isNullSize = items.size == 12 || items.size == 21 - LaunchedEffect(scrollState) { snapshotFlow { scrollState.firstVisibleItemIndex } .map { index -> - var newItem = items - if (isNullSize) newItem = items + NULL_DATE - newItem.getOrNull(index) + val hasNullDate = + items.size == (END_YEAR - START_YEAR + 1) || items.size == (END_MONTH - START_MONTH + 1) + val adjustedItems = if (hasNullDate) items + NULL_DATE else items + adjustedItems.getOrNull(index) } .distinctUntilChanged() .collect { item -> From 0b4fa70132f95fd2e10424a08378da5f5331ffd9 Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Sat, 21 Dec 2024 04:02:19 +0900 Subject: [PATCH 14/19] =?UTF-8?q?[MOD/#309]=20=EB=B6=88=ED=95=84=EC=9A=94?= =?UTF-8?q?=ED=95=9C=20=EB=B3=80=EC=88=98=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../terning/feature/home/component/HomeFilteringBottomSheet.kt | 2 +- .../com/terning/feature/home/component/HomeYearMonthPicker.kt | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/feature/home/src/main/java/com/terning/feature/home/component/HomeFilteringBottomSheet.kt b/feature/home/src/main/java/com/terning/feature/home/component/HomeFilteringBottomSheet.kt index f7fb5456..df8ded53 100644 --- a/feature/home/src/main/java/com/terning/feature/home/component/HomeFilteringBottomSheet.kt +++ b/feature/home/src/main/java/com/terning/feature/home/component/HomeFilteringBottomSheet.kt @@ -154,7 +154,7 @@ fun HomeFilteringBottomSheet( .padding(horizontal = 24.dp) ) - //todo: 아래는 예시 체크박스로, 추후 수정 부탁합니다! + //todo: 아래는 임시 체크박스로, 추후 수정 부탁합니다! Checkbox( checked = isCheckBoxChecked, onCheckedChange = { isChecked -> diff --git a/feature/home/src/main/java/com/terning/feature/home/component/HomeYearMonthPicker.kt b/feature/home/src/main/java/com/terning/feature/home/component/HomeYearMonthPicker.kt index 0a332753..21544f77 100644 --- a/feature/home/src/main/java/com/terning/feature/home/component/HomeYearMonthPicker.kt +++ b/feature/home/src/main/java/com/terning/feature/home/component/HomeYearMonthPicker.kt @@ -171,12 +171,11 @@ fun DatePicker( Spacer(modifier = Modifier.height(itemHeightDp)) } items(items.size) { index -> - val isSelected = pickerState.selectedItem == items[index] DatePickerContent( modifier = Modifier .onSizeChanged { intSize: IntSize -> itemHeightPixel = intSize.height }, text = items[index], - color = if (isSelected) Grey500 else Grey300 + color = if (pickerState.selectedItem == items[index]) Grey500 else Grey300 ) } items(visibleItemsMiddle) { From d47d73ffe271f69c518aa3807acbcb282f59b5e6 Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Sat, 21 Dec 2024 04:09:51 +0900 Subject: [PATCH 15/19] =?UTF-8?q?[MOD/#309]=20=EB=A1=9C=EC=A7=81=20?= =?UTF-8?q?=EC=95=8C=EB=A7=9E=EA=B2=8C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../feature/home/component/HomeFilteringBottomSheet.kt | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/feature/home/src/main/java/com/terning/feature/home/component/HomeFilteringBottomSheet.kt b/feature/home/src/main/java/com/terning/feature/home/component/HomeFilteringBottomSheet.kt index df8ded53..3dab80b1 100644 --- a/feature/home/src/main/java/com/terning/feature/home/component/HomeFilteringBottomSheet.kt +++ b/feature/home/src/main/java/com/terning/feature/home/component/HomeFilteringBottomSheet.kt @@ -61,9 +61,8 @@ fun HomeFilteringBottomSheet( ) } - // todo: 아래 변수의 mutableStateOf 값을 각각 "defaultStartYear != null"로 넣어주세요. - var isYearNull by remember { mutableStateOf(false) } - var isMonthNull by remember { mutableStateOf(false) } + var isYearNull by remember { mutableStateOf(defaultStartYear != null) } + var isMonthNull by remember { mutableStateOf(defaultStartMonth != null) } var isCheckBoxChecked by remember { mutableStateOf(false) } @@ -154,7 +153,7 @@ fun HomeFilteringBottomSheet( .padding(horizontal = 24.dp) ) - //todo: 아래는 임시 체크박스로, 추후 수정 부탁합니다! + //TODO: 아래는 임시 체크박스로, 추후 수정 부탁합니다! Checkbox( checked = isCheckBoxChecked, onCheckedChange = { isChecked -> From 8079dc193579d80b9fcac544def0aff8d45c327c Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Sat, 21 Dec 2024 04:12:38 +0900 Subject: [PATCH 16/19] =?UTF-8?q?[FEAT/#309]=20ImmutableList=20=EC=A0=81?= =?UTF-8?q?=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../home/component/HomeFilteringBottomSheet.kt | 5 +++-- .../feature/home/component/HomeYearMonthPicker.kt | 12 ++++++------ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/feature/home/src/main/java/com/terning/feature/home/component/HomeFilteringBottomSheet.kt b/feature/home/src/main/java/com/terning/feature/home/component/HomeFilteringBottomSheet.kt index 3dab80b1..47d7df74 100644 --- a/feature/home/src/main/java/com/terning/feature/home/component/HomeFilteringBottomSheet.kt +++ b/feature/home/src/main/java/com/terning/feature/home/component/HomeFilteringBottomSheet.kt @@ -33,6 +33,7 @@ import com.terning.core.designsystem.theme.Grey200 import com.terning.core.designsystem.theme.TerningTheme import com.terning.core.designsystem.type.Grade import com.terning.core.designsystem.type.WorkingPeriod +import kotlinx.collections.immutable.toImmutableList import java.util.Calendar @OptIn(ExperimentalMaterial3Api::class) @@ -187,8 +188,8 @@ fun HomeFilteringBottomSheet( }, isYearNull = isYearNull, isMonthNull = isMonthNull, - yearsList = yearsList, - monthsList = monthsList, + yearsList = yearsList.toImmutableList(), + monthsList = monthsList.toImmutableList(), isInitialNullState = isInitialNullState ) diff --git a/feature/home/src/main/java/com/terning/feature/home/component/HomeYearMonthPicker.kt b/feature/home/src/main/java/com/terning/feature/home/component/HomeYearMonthPicker.kt index 21544f77..a57ee388 100644 --- a/feature/home/src/main/java/com/terning/feature/home/component/HomeYearMonthPicker.kt +++ b/feature/home/src/main/java/com/terning/feature/home/component/HomeYearMonthPicker.kt @@ -38,13 +38,13 @@ import com.terning.core.designsystem.util.CalendarDefaults.END_MONTH import com.terning.core.designsystem.util.CalendarDefaults.END_YEAR import com.terning.core.designsystem.util.CalendarDefaults.START_MONTH import com.terning.core.designsystem.util.CalendarDefaults.START_YEAR +import kotlinx.collections.immutable.ImmutableList import kotlinx.coroutines.flow.distinctUntilChanged import kotlinx.coroutines.flow.map -import okhttp3.internal.toImmutableList -val years = (START_YEAR..END_YEAR).map { "${it}년" }.toImmutableList() +val years = (START_YEAR..END_YEAR).map { "${it}년" } -val months = (START_MONTH..END_MONTH).map { "${it}월" }.toImmutableList() +val months = (START_MONTH..END_MONTH).map { "${it}월" } const val NULL_DATE = "-" @@ -64,8 +64,8 @@ fun HomeYearMonthPicker( onMonthChosen: (Int?, Boolean) -> Unit, isYearNull: Boolean, isMonthNull: Boolean, - yearsList: List, - monthsList: List, + yearsList: ImmutableList, + monthsList: ImmutableList, isInitialNullState: Boolean ) { val yearPickerState = rememberPickerState() @@ -119,7 +119,7 @@ fun HomeYearMonthPicker( @Composable fun DatePicker( - items: List, + items: ImmutableList, modifier: Modifier = Modifier, pickerState: PickerState = rememberPickerState(), startIndex: Int = 0, From a4424aa7e5a65e7779fbd156ed36a156bd51b7b6 Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Sat, 21 Dec 2024 04:34:35 +0900 Subject: [PATCH 17/19] =?UTF-8?q?[MOD/#309]=20=EB=B6=88=ED=95=84=EC=9A=94?= =?UTF-8?q?=ED=95=9C=20=EB=B8=94=EB=A1=9D=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/terning/feature/home/component/HomeYearMonthPicker.kt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/feature/home/src/main/java/com/terning/feature/home/component/HomeYearMonthPicker.kt b/feature/home/src/main/java/com/terning/feature/home/component/HomeYearMonthPicker.kt index a57ee388..0d9ecc25 100644 --- a/feature/home/src/main/java/com/terning/feature/home/component/HomeYearMonthPicker.kt +++ b/feature/home/src/main/java/com/terning/feature/home/component/HomeYearMonthPicker.kt @@ -134,9 +134,7 @@ fun DatePicker( val flingBehavior = rememberSnapFlingBehavior(lazyListState = scrollState) LaunchedEffect(itemHeightPixel, startIndex) { - if (itemHeightPixel > 0 && startIndex >= 0) { - scrollState.scrollToItem(startIndex) - } + if (itemHeightPixel > 0 && startIndex >= 0) scrollState.scrollToItem(startIndex) } LaunchedEffect(scrollState) { From c2e1a666ee2361c1aa0deb5b1e1e6e162ad11f30 Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Sat, 21 Dec 2024 04:41:33 +0900 Subject: [PATCH 18/19] =?UTF-8?q?[MOD/#309]=20=EB=B3=80=EC=88=98=EA=B0=84?= =?UTF-8?q?=20=EA=B3=B5=EB=B0=B1=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/terning/feature/home/component/HomeYearMonthPicker.kt | 1 - 1 file changed, 1 deletion(-) diff --git a/feature/home/src/main/java/com/terning/feature/home/component/HomeYearMonthPicker.kt b/feature/home/src/main/java/com/terning/feature/home/component/HomeYearMonthPicker.kt index 0d9ecc25..6a35a793 100644 --- a/feature/home/src/main/java/com/terning/feature/home/component/HomeYearMonthPicker.kt +++ b/feature/home/src/main/java/com/terning/feature/home/component/HomeYearMonthPicker.kt @@ -43,7 +43,6 @@ import kotlinx.coroutines.flow.distinctUntilChanged import kotlinx.coroutines.flow.map val years = (START_YEAR..END_YEAR).map { "${it}년" } - val months = (START_MONTH..END_MONTH).map { "${it}월" } const val NULL_DATE = "-" From e9c032373bc3f65335cbd845606be179c476e1a6 Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Sat, 21 Dec 2024 04:41:50 +0900 Subject: [PATCH 19/19] =?UTF-8?q?[MOD/#309]=20=EB=B3=80=EC=88=98=EA=B0=84?= =?UTF-8?q?=20=EA=B3=B5=EB=B0=B1=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/terning/feature/home/component/HomeYearMonthPicker.kt | 1 - 1 file changed, 1 deletion(-) diff --git a/feature/home/src/main/java/com/terning/feature/home/component/HomeYearMonthPicker.kt b/feature/home/src/main/java/com/terning/feature/home/component/HomeYearMonthPicker.kt index 6a35a793..d1f613ea 100644 --- a/feature/home/src/main/java/com/terning/feature/home/component/HomeYearMonthPicker.kt +++ b/feature/home/src/main/java/com/terning/feature/home/component/HomeYearMonthPicker.kt @@ -75,7 +75,6 @@ fun HomeYearMonthPicker( val startYearIndex = if (isYearNull) yearsList.lastIndex else yearsList.indexOf("${chosenYear ?: "-"}년") .takeIf { it >= 0 } ?: 0 - val startMonthIndex = if (isMonthNull) monthsList.lastIndex else monthsList.indexOf("${chosenMonth ?: "-"}월") .takeIf { it >= 0 } ?: 0