From ec0560333158c4a38807556f29c02c3d593a2558 Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Sat, 12 Oct 2024 02:35:39 +0900 Subject: [PATCH 1/3] [FIX/#286] coil version upgrade --- core/build.gradle.kts | 4 +++- .../terning/core/designsystem/component/item/InternItem.kt | 4 ++-- feature/build.gradle.kts | 4 +++- .../java/com/terning/feature/dialog/detail/ScrapDialog.kt | 4 ++-- .../feature/home/component/HomeUpcomingInternScreen.kt | 4 ++-- .../terning/feature/intern/component/InternCompanyInfo.kt | 6 +++--- .../terning/feature/search/search/component/SearchIntern.kt | 5 +++-- 7 files changed, 18 insertions(+), 13 deletions(-) diff --git a/core/build.gradle.kts b/core/build.gradle.kts index 6c71ee666..a6ddd8c00 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -77,7 +77,9 @@ dependencies { androidTestImplementation(libs.androidx.espresso.core) //ThirdPartyDependencies - implementation(libs.compose.coil) + // implementation(libs.compose.coil) + implementation("io.coil-kt.coil3:coil-compose:3.0.0-rc01") + implementation("io.coil-kt.coil3:coil-network-okhttp:3.0.0-rc01") implementation(libs.okhttp) implementation(libs.lottie) } \ No newline at end of file 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 8511fc81c..5f3e04bca 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 @@ -26,8 +26,8 @@ import androidx.compose.ui.text.TextStyle import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp -import coil.compose.AsyncImage -import coil.request.ImageRequest +import coil3.compose.AsyncImage +import coil3.request.ImageRequest import com.terning.core.R import com.terning.core.designsystem.theme.Grey300 import com.terning.core.designsystem.theme.Grey400 diff --git a/feature/build.gradle.kts b/feature/build.gradle.kts index 02180fd6f..a3a268538 100644 --- a/feature/build.gradle.kts +++ b/feature/build.gradle.kts @@ -88,7 +88,9 @@ dependencies { androidTestImplementation(libs.androidx.espresso.core) // ThirdPartyDependencies - implementation(libs.compose.coil) + //implementation(libs.compose.coil) + implementation("io.coil-kt.coil3:coil-compose:3.0.0-rc01") + implementation("io.coil-kt.coil3:coil-network-okhttp:3.0.0-rc01") implementation(libs.timber) implementation(libs.ossLicense) implementation(libs.lottie) diff --git a/feature/src/main/java/com/terning/feature/dialog/detail/ScrapDialog.kt b/feature/src/main/java/com/terning/feature/dialog/detail/ScrapDialog.kt index 5ae677c64..86e9e171d 100644 --- a/feature/src/main/java/com/terning/feature/dialog/detail/ScrapDialog.kt +++ b/feature/src/main/java/com/terning/feature/dialog/detail/ScrapDialog.kt @@ -34,8 +34,8 @@ import androidx.hilt.navigation.compose.hiltViewModel import androidx.lifecycle.compose.LocalLifecycleOwner import androidx.lifecycle.compose.collectAsStateWithLifecycle import androidx.lifecycle.flowWithLifecycle -import coil.compose.AsyncImage -import coil.request.ImageRequest +import coil3.compose.AsyncImage +import coil3.request.ImageRequest import com.terning.core.designsystem.component.button.RoundButton import com.terning.core.designsystem.component.dialog.TerningBasicDialog import com.terning.core.designsystem.theme.Grey100 diff --git a/feature/src/main/java/com/terning/feature/home/component/HomeUpcomingInternScreen.kt b/feature/src/main/java/com/terning/feature/home/component/HomeUpcomingInternScreen.kt index e2adffbbe..f94d242d4 100644 --- a/feature/src/main/java/com/terning/feature/home/component/HomeUpcomingInternScreen.kt +++ b/feature/src/main/java/com/terning/feature/home/component/HomeUpcomingInternScreen.kt @@ -30,8 +30,8 @@ import androidx.compose.ui.graphics.Color import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp -import coil.compose.AsyncImage -import coil.request.ImageRequest +import coil3.compose.AsyncImage +import coil3.request.ImageRequest import com.terning.core.designsystem.component.item.ScrapBox import com.terning.core.designsystem.theme.Black import com.terning.core.designsystem.theme.Grey150 diff --git a/feature/src/main/java/com/terning/feature/intern/component/InternCompanyInfo.kt b/feature/src/main/java/com/terning/feature/intern/component/InternCompanyInfo.kt index 13d710d62..342cf3cb0 100644 --- a/feature/src/main/java/com/terning/feature/intern/component/InternCompanyInfo.kt +++ b/feature/src/main/java/com/terning/feature/intern/component/InternCompanyInfo.kt @@ -7,7 +7,6 @@ import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size -import androidx.compose.foundation.shape.CircleShape import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material3.Text import androidx.compose.runtime.Composable @@ -19,8 +18,9 @@ import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.dp -import coil.compose.AsyncImage -import coil.request.ImageRequest +import coil3.compose.AsyncImage +import coil3.request.ImageRequest +import coil3.request.crossfade import com.terning.core.designsystem.theme.Black import com.terning.core.designsystem.theme.Grey150 import com.terning.core.designsystem.theme.Grey350 diff --git a/feature/src/main/java/com/terning/feature/search/search/component/SearchIntern.kt b/feature/src/main/java/com/terning/feature/search/search/component/SearchIntern.kt index cdc1f8971..63400bfc6 100644 --- a/feature/src/main/java/com/terning/feature/search/search/component/SearchIntern.kt +++ b/feature/src/main/java/com/terning/feature/search/search/component/SearchIntern.kt @@ -24,8 +24,9 @@ import androidx.compose.ui.text.TextStyle import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.dp -import coil.compose.AsyncImage -import coil.request.ImageRequest +import coil3.compose.AsyncImage +import coil3.request.ImageRequest +import coil3.request.crossfade import com.terning.core.designsystem.theme.Black import com.terning.core.designsystem.theme.Grey100 import com.terning.core.designsystem.theme.Grey150 From 21729acecef22a7ea309c8e5b1f6637c5ca5c768 Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Sat, 12 Oct 2024 02:46:12 +0900 Subject: [PATCH 2/3] =?UTF-8?q?[FIX/#286]=20version=20catalog=EC=97=90=20c?= =?UTF-8?q?oil=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 | 5 ++--- feature/build.gradle.kts | 5 ++--- gradle/libs.versions.toml | 41 ++++++++++++++++++++------------------- 3 files changed, 25 insertions(+), 26 deletions(-) diff --git a/core/build.gradle.kts b/core/build.gradle.kts index a6ddd8c00..fa947cc16 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -77,9 +77,8 @@ dependencies { androidTestImplementation(libs.androidx.espresso.core) //ThirdPartyDependencies - // implementation(libs.compose.coil) - implementation("io.coil-kt.coil3:coil-compose:3.0.0-rc01") - implementation("io.coil-kt.coil3:coil-network-okhttp:3.0.0-rc01") + implementation(libs.coil.compose) + implementation(libs.coil.network.okhttp) implementation(libs.okhttp) implementation(libs.lottie) } \ No newline at end of file diff --git a/feature/build.gradle.kts b/feature/build.gradle.kts index a3a268538..1dcf9fcba 100644 --- a/feature/build.gradle.kts +++ b/feature/build.gradle.kts @@ -88,9 +88,8 @@ dependencies { androidTestImplementation(libs.androidx.espresso.core) // ThirdPartyDependencies - //implementation(libs.compose.coil) - implementation("io.coil-kt.coil3:coil-compose:3.0.0-rc01") - implementation("io.coil-kt.coil3:coil-network-okhttp:3.0.0-rc01") + implementation(libs.coil.compose) + implementation(libs.coil.network.okhttp) implementation(libs.timber) implementation(libs.ossLicense) implementation(libs.lottie) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index dee91014d..305e36f2f 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -54,7 +54,7 @@ coroutine = "1.8.1" timber = "5.0.1" ## Coil -coil = "2.4.0" +coilCompose = "3.0.0-rc01" ## Security securityVersion = "1.1.0-alpha06" @@ -100,11 +100,11 @@ androidx-junit = { group = "androidx.test.ext", name = "junit", version.ref = "j androidx-activity-compose = { group = "androidx.activity", name = "activity-compose", version.ref = "androidxActivity" } androidx-lifecycle-runtime-ktx = { group = "androidx.lifecycle", name = "lifecycle-runtime-ktx", version.ref = "lifecycleRuntimeKtx" } androidx-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" } -androidx-workManager = {group = "androidx.work", name = "work-runtime-ktx", version.ref = "workManagerVersion"} -androidx-hiltWorkManager = {group = "androidx.hilt", name = "hilt-work", version.ref = "hiltManager"} -androidx-hiltWorkManagerCompiler = {group = "androidx.hilt", name = "hilt-compiler" , version.ref = "hiltManager"} -androidx-navigation-compose = {module = "androidx.navigation:navigation-compose", version.ref = "composeNavigation"} -androidx-browser = {group = "androidx.browser", name = "browser", version.ref ="browser"} +androidx-workManager = { group = "androidx.work", name = "work-runtime-ktx", version.ref = "workManagerVersion" } +androidx-hiltWorkManager = { group = "androidx.hilt", name = "hilt-work", version.ref = "hiltManager" } +androidx-hiltWorkManagerCompiler = { group = "androidx.hilt", name = "hilt-compiler", version.ref = "hiltManager" } +androidx-navigation-compose = { module = "androidx.navigation:navigation-compose", version.ref = "composeNavigation" } +androidx-browser = { group = "androidx.browser", name = "browser", version.ref = "browser" } androidx-compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "androidxComposeBom" } androidx-compose-material3 = { group = "androidx.compose.material3", name = "material3", version.ref = "androidxComposeMaterial3" } @@ -113,7 +113,7 @@ androidx-compose-ui-test = { group = "androidx.compose.ui", name = "ui-test-juni androidx-compose-ui-testManifest = { group = "androidx.compose.ui", name = "ui-test-manifest" } androidx-compose-navigation = { group = "androidx.navigation", name = "navigation-compose", version.ref = "composeNavigation" } androidx-compose-navigation-test = { group = "androidx.navigation", name = "navigation-testing", version.ref = "composeNavigation" } -androidx-compose-saveable = {group = "androidx.compose.runtime", name = "runtime-saveable", version.ref = "composeSavable"} +androidx-compose-saveable = { group = "androidx.compose.runtime", name = "runtime-saveable", version.ref = "composeSavable" } compose-compiler-gradle-plugin = { module = "org.jetbrains.kotlin:compose-compiler-gradle-plugin", version.ref = "kotlin" } androidx-ui = { group = "androidx.compose.ui", name = "ui" } @@ -122,7 +122,7 @@ androidx-ui-test-junit4 = { group = "androidx.compose.ui", name = "ui-test-junit androidx-foundation-android = { group = "androidx.compose.foundation", name = "foundation-android", version.ref = "foundationAndroid" } androidx-material3-android = { group = "androidx.compose.material3", name = "material3-android", version.ref = "material3Android" } androidx-lifecycle-runtime-compose-android = { group = "androidx.lifecycle", name = "lifecycle-runtime-compose-android", version.ref = "lifecycleRuntimeComposeAndroid" } -androidx-security = {group = "androidx.security", name = "security-crypto" , version.ref = "securityVersion"} +androidx-security = { group = "androidx.security", name = "security-crypto", version.ref = "securityVersion" } android-gradlePlugin = { group = "com.android.tools.build", name = "gradle", version.ref = "androidGradlePlugin" } android-desugarJdkLibs = { group = "com.android.tools", name = "desugar_jdk_libs", version.ref = "androidDesugarJdkLibs" } androidx-lifecycle-runtimeCompose = { group = "androidx.lifecycle", name = "lifecycle-runtime-compose", version.ref = "androidxLifecycle" } @@ -136,10 +136,10 @@ hilt-android = { group = "com.google.dagger", name = "hilt-android", version.ref hilt-android-testing = { group = "com.google.dagger", name = "hilt-android-testing", version.ref = "hilt" } hilt-android-compiler = { group = "com.google.dagger", name = "hilt-android-compiler", version.ref = "hilt" } hilt-navigation-compose = { group = "androidx.hilt", name = "hilt-navigation-compose", version.ref = "hiltNavigationCompose" } -hilt-manager = {group = "androidx.hilt" , name = "hilt-compiler", version.ref = "hiltManager"} +hilt-manager = { group = "androidx.hilt", name = "hilt-compiler", version.ref = "hiltManager" } -okhttp = {group = "com.squareup.okhttp3", name = "okhttp"} -okhttp-bom = {group = "com.squareup.okhttp3" , name = "okhttp-bom" , version.ref = "okhttp"} +okhttp = { group = "com.squareup.okhttp3", name = "okhttp" } +okhttp-bom = { group = "com.squareup.okhttp3", name = "okhttp-bom", version.ref = "okhttp" } okhttp-logging = { group = "com.squareup.okhttp3", name = "logging-interceptor", version.ref = "okhttp" } retrofit-core = { group = "com.squareup.retrofit2", name = "retrofit", version.ref = "retrofit" } retrofit-kotlin-serialization = { module = "com.squareup.retrofit2:converter-kotlinx-serialization", version.ref = "retrofit" } @@ -147,27 +147,28 @@ retrofit2-kotlinx-serialization-converter = { module = "com.jakewharton.retrofit retrofit2-kotlinx-serialization-converter-v080 = { module = "com.jakewharton.retrofit:retrofit2-kotlinx-serialization-converter", version.ref = "retrofit2KotlinxSerializationConverter" } kotlinx-serialization-json-v151 = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlinxSerializationJsonVersion" } -kotlinx-serialization-json = {module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "serialization"} +kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "serialization" } kotlinx-immutable = { group = "org.jetbrains.kotlinx", name = "kotlinx-collections-immutable", version.ref = "kotlinxImmutable" } coroutines-core = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-core", version.ref = "coroutine" } coroutines-android = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-android", version.ref = "coroutine" } coroutines-test = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-test", version.ref = "coroutine" } -kotlin = {group = "org.jetbrains.kotlin" , name = "kotlin-stdlib", version.ref = "kotlin"} +kotlin = { group = "org.jetbrains.kotlin", name = "kotlin-stdlib", version.ref = "kotlin" } kotlin-gradlePlugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" } +coil-compose = { module = "io.coil-kt.coil3:coil-compose", version.ref = "coilCompose" } +coil-network-okhttp = { module = "io.coil-kt.coil3:coil-network-okhttp", version.ref = "coilCompose" } kotest-runner = { group = "io.kotest", name = "kotest-runner-junit5", version.ref = "kotest" } kotest-assertions = { group = "io.kotest", name = "kotest-assertions-core", version.ref = "kotest" } androidx-test-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCoreVersion" } -compose-coil = {group = "io.coil-kt", name = "coil-compose", version.ref = "coil"} material = { group = "com.google.android.material", name = "material", version.ref = "material" } timber = { module = "com.jakewharton.timber:timber", version.ref = "timber" } -ossLicense = {group = "com.google.android.gms", name = "play-services-oss-licenses", version.ref = "ossVersion"} -lottie = {group = "com.airbnb.android", name = "lottie-compose", version.ref = "lottieVersion"} +ossLicense = { group = "com.google.android.gms", name = "play-services-oss-licenses", version.ref = "ossVersion" } +lottie = { group = "com.airbnb.android", name = "lottie-compose", version.ref = "lottieVersion" } -kakao-user = {group = "com.kakao.sdk", name = "v2-user", version.ref = "kakaoVersion"} +kakao-user = { group = "com.kakao.sdk", name = "v2-user", version.ref = "kakaoVersion" } -process-phoenix = {group = "com.jakewharton", name = "process-phoenix", version.ref = "processPhoenix"} +process-phoenix = { group = "com.jakewharton", name = "process-phoenix", version.ref = "processPhoenix" } accompanist-systemuicontroller = { module = "com.google.accompanist:accompanist-systemuicontroller", version.ref = "accompanistSystemuicontroller" } [plugins] @@ -178,6 +179,6 @@ kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" } hilt = { id = "com.google.dagger.hilt.android", version.ref = "hilt" } android-test = { id = "com.android.test", version.ref = "androidGradlePlugin" } -ksp = {id = "com.google.devtools.ksp", version.ref = "ksp"} +ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" } kotlin-parcelize = { id = "org.jetbrains.kotlin.plugin.parcelize", version.ref = "kotlinParcelize" } -dokka = {id = "org.jetbrains.dokka", version.ref = "dokka"} \ No newline at end of file +dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" } \ No newline at end of file From 3cff6faf69394f2907af2c6b92da8515dabd63b6 Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Sat, 12 Oct 2024 03:03:05 +0900 Subject: [PATCH 3/3] =?UTF-8?q?[FIX/#286]=20=EA=B8=B0=EC=A1=B4=20date=20pi?= =?UTF-8?q?cker=20=ED=8C=8C=EC=9D=BC=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/datepicker/DatePicker.kt | 178 ------------------ 1 file changed, 178 deletions(-) delete mode 100644 core/src/main/java/com/terning/core/designsystem/component/datepicker/DatePicker.kt diff --git a/core/src/main/java/com/terning/core/designsystem/component/datepicker/DatePicker.kt b/core/src/main/java/com/terning/core/designsystem/component/datepicker/DatePicker.kt deleted file mode 100644 index cd669a8b0..000000000 --- a/core/src/main/java/com/terning/core/designsystem/component/datepicker/DatePicker.kt +++ /dev/null @@ -1,178 +0,0 @@ -package com.terning.core.designsystem.component.datepicker - -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.fillMaxHeight -import androidx.compose.foundation.layout.fillMaxWidth -import androidx.compose.foundation.layout.height -import androidx.compose.foundation.layout.size -import androidx.compose.foundation.layout.width -import androidx.compose.foundation.lazy.LazyColumn -import androidx.compose.foundation.lazy.rememberLazyListState -import androidx.compose.material3.HorizontalDivider -import androidx.compose.material3.Text -import androidx.compose.runtime.Composable -import androidx.compose.runtime.LaunchedEffect -import androidx.compose.runtime.derivedStateOf -import androidx.compose.runtime.getValue -import androidx.compose.runtime.mutableStateOf -import androidx.compose.runtime.remember -import androidx.compose.ui.Alignment -import androidx.compose.ui.Modifier -import androidx.compose.ui.text.style.TextAlign -import androidx.compose.ui.unit.dp -import com.terning.core.designsystem.theme.Grey300 -import com.terning.core.designsystem.theme.Grey500 -import com.terning.core.designsystem.theme.TerningMain -import com.terning.core.designsystem.theme.TerningTheme -import okhttp3.internal.toImmutableList - -private const val START_YEAR = 2023 -private const val END_YEAR = 2025 -private const val START_MONTH = 1 -private const val END_MONTH = 12 -private val years = - (listOf("") + (START_YEAR..END_YEAR).map { it.toString() } + listOf("") + listOf("")).toImmutableList() -private val monthsNumber = - (listOf("") + (START_MONTH..END_MONTH).map { it.toString() } + listOf("") + listOf("")).toImmutableList() - -/** - * 데이트 피커를 나타냅니다. - * - * 사용자가 원하는 연도와 월을 설정할 수 있습니다. - * - * @param chosenYear 선택된 연도를 나타내는 값입니다. - * @param chosenMonth 선택된 월을 나타내는 값입니다. - * @param onYearChosen 연도가 선택되었을 때 호출되는 콜백 함수입니다. - * @param onMonthChosen 월이 선택되었을 때 호출되는 콜백 함수입니다. - */ -@Composable -fun DatePickerUI( - chosenYear: Int, - chosenMonth: Int, - onYearChosen: (Int) -> Unit = {}, - onMonthChosen: (Int) -> Unit = {}, -) { - - Column( - horizontalAlignment = Alignment.CenterHorizontally, - modifier = Modifier.fillMaxWidth() - ) { - DateSelectionSection( - chosenYear = chosenYear, - chosenMonth = chosenMonth, - onYearChosen = { onYearChosen(it.toInt()) }, - onMonthChosen = { onMonthChosen(it.toInt()) }, - ) - } -} - -/** - * 연도와 월을 선택할 수 있는 두 개의 피커를 제공합니다. - * - * @param chosenYear 선택된 연도를 나타내는 값입니다. - * @param chosenMonth 선택된 월을 나타내는 값입니다. - * @param onYearChosen 연도가 선택되었을 때 호출되는 콜백 함수입니다. - * @param onMonthChosen 월이 선택되었을 때 호출되는 콜백 함수입니다. - */ -@Composable -fun DateSelectionSection( - chosenYear: Int, - chosenMonth: Int, - onYearChosen: (String) -> Unit, - onMonthChosen: (String) -> Unit, -) { - Row( - horizontalArrangement = Arrangement.Center, - modifier = Modifier.fillMaxWidth() - ) { - DateItemsPicker( - items = years.toImmutableList(), - firstIndex = (chosenYear - START_YEAR), - onItemSelected = onYearChosen, - isYear = true - ) - Spacer(modifier = Modifier.width(25.dp)) - DateItemsPicker( - items = monthsNumber.toImmutableList(), - firstIndex = chosenMonth, - onItemSelected = onMonthChosen, - isYear = false - ) - } -} - -/** - * 사용자가 스크롤을 통해 연도 또는 월을 선택할 수 있는 피커입니다. - * - * @param items 선택 가능한 항목들의 리스트입니다. (연도 또는 월) - * @param firstIndex 초기 선택된 항목의 인덱스입니다. (연도 또는 월) - * @param onItemSelected 항목이 선택되었을 때 호출되는 콜백 함수입니다. - * @param modifier 레이아웃, 동작 등을 수정할 수 있는 Modifier 옵션입니다. - * @param isYear 이 피커가 연도를 선택하는 것인지에 대한 여부입니다. - */ -@Composable -fun DateItemsPicker( - items: List, - firstIndex: Int, - onItemSelected: (String) -> Unit, - modifier: Modifier = Modifier, - isYear: Boolean -) { - val listState = rememberLazyListState(firstIndex) - val currentValue = remember { mutableStateOf("") } - - LaunchedEffect(!listState.isScrollInProgress) { - onItemSelected(currentValue.value) - listState.animateScrollToItem(index = listState.firstVisibleItemIndex) - } - - Box( - modifier = Modifier.height(108.dp), - contentAlignment = Alignment.Center - ) { - Column( - modifier = modifier.fillMaxHeight(), - verticalArrangement = Arrangement.SpaceEvenly - ) { - HorizontalDivider( - modifier = Modifier.size(height = 1.dp, width = 71.dp), - color = TerningMain - ) - HorizontalDivider( - modifier = Modifier.size(height = 1.dp, width = 71.dp), - color = TerningMain - ) - } - LazyColumn( - modifier = modifier, - horizontalAlignment = Alignment.CenterHorizontally, - state = listState, - ) { - items(items.size) { - val index = it % items.size - val firstVisibleItemIndex by remember { - derivedStateOf { listState.firstVisibleItemIndex } - } - if (it == firstVisibleItemIndex + 1) { - currentValue.value = items[index] - } - Spacer(modifier = Modifier.height(7.dp)) - Text( - text = - when (isYear) { - true -> if (items[index].isNotEmpty()) "${items[index]}년" else "" - false -> if (items[index].isNotEmpty()) "${items[index]}월" else "" - }, - style = TerningTheme.typography.title3, - color = if (it == firstVisibleItemIndex + 1) Grey500 else Grey300, - textAlign = TextAlign.Center - ) - Spacer(modifier = Modifier.height(7.dp)) - } - } - } -} \ No newline at end of file