Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import org.jetbrains.kotlin.compose.compiler.gradle.ComposeCompilerGradlePluginE
internal fun Project.configureComposeAndroid() {
with(plugins) {
apply("org.jetbrains.kotlin.plugin.compose")
apply("com.github.skydoves.compose.stability.analyzer")
}

val libs = extensions.libs
Expand Down
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ plugins {
alias(libs.plugins.google.service) apply false
alias(libs.plugins.firebase.app.distribution) apply false
alias(libs.plugins.firebase.crashlytics) apply false
alias(libs.plugins.stability.analyzer) apply false
}

apply {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.yapp.common.navigation

import android.util.Log
import androidx.compose.runtime.Composable
import androidx.compose.runtime.Stable
import androidx.compose.runtime.remember
import androidx.navigation.NavHostController
import androidx.navigation.NavOptions
Expand All @@ -20,6 +21,7 @@ import com.yapp.common.navigation.route.SplashRoute
import com.yapp.common.navigation.route.WebViewRoute
import com.yapp.domain.model.Alarm

@Stable
class OrbitNavigator(
val navController: NavHostController,
) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
package com.yapp.designsystem.theme

import androidx.compose.runtime.Stable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue
import androidx.compose.runtime.staticCompositionLocalOf
import androidx.compose.ui.graphics.Color

@Stable
class OrbitColors(
main: Color = Color(0xFFFEFF65),
sub_main: Color = Color(0xFFFDFE90),
Expand Down
1 change: 0 additions & 1 deletion core/network/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,4 @@ dependencies {
implementation(libs.retrofit.kotlin.serialization)
implementation(libs.okhttp.logging)
implementation(libs.kotlinx.serialization.json)
implementation(libs.process.phoenix)
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import androidx.compose.material.ModalBottomSheetState
import androidx.compose.material.ModalBottomSheetValue
import androidx.compose.material.rememberModalBottomSheetState
import androidx.compose.runtime.Composable
import androidx.compose.runtime.Stable
import androidx.compose.runtime.State
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
Expand Down Expand Up @@ -32,6 +33,7 @@ fun rememberOrbitBottomSheetState(): OrbitBottomSheetState {
}
}

@Stable
class OrbitBottomSheetState(
val state: ModalBottomSheetState,
val contentState: State<BottomSheetContent?>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.derivedStateOf
import androidx.compose.runtime.Stable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.remember
Expand All @@ -27,11 +27,11 @@ import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import com.yapp.designsystem.theme.OrbitTheme
import com.yapp.ui.utils.toPx
import kotlinx.coroutines.flow.distinctUntilChanged
import kotlinx.coroutines.flow.map
import kotlin.math.abs

@Stable
@Composable
fun <T> OrbitPickerItem(
modifier: Modifier = Modifier,
Expand Down Expand Up @@ -113,25 +113,6 @@ fun <T> OrbitPickerItem(
.pointerInput(Unit) { detectVerticalDragGestures { change, _ -> change.consume() } },
) {
items(listScrollCount, key = { index -> index }) { index ->
val layoutInfo by remember { derivedStateOf { listState.layoutInfo } }

val viewportCenterOffset = layoutInfo.viewportStartOffset +
(layoutInfo.viewportEndOffset - layoutInfo.viewportStartOffset) / 2

val itemInfo = layoutInfo.visibleItemsInfo.find { it.index == index }
val itemCenterOffset = itemInfo?.offset?.let { it + (itemInfo.size / 2) } ?: 0

val distanceFromCenter = abs(viewportCenterOffset - itemCenterOffset)
val maxDistance = totalItemHeight.toPx() * visibleItemsMiddle

val alpha = if (distanceFromCenter <= maxDistance) {
((maxDistance - distanceFromCenter) / maxDistance).coerceIn(0.2f, 1f)
} else {
0.2f
}

val scaleY = 1f - (0.2f * (distanceFromCenter / maxDistance)).coerceIn(0f, 0.4f)

val item = getItemForIndex(
index = index,
items = items,
Expand All @@ -143,10 +124,29 @@ fun <T> OrbitPickerItem(
text = item?.let { itemFormatter(it) } ?: "",
maxLines = 1,
style = textStyle,
color = OrbitTheme.colors.white.copy(alpha = alpha),
color = OrbitTheme.colors.white,
modifier = Modifier
.padding(vertical = itemSpacing / 2)
.graphicsLayer(scaleY = scaleY)
.graphicsLayer {
val layoutInfo = listState.layoutInfo

val viewportCenterOffset = layoutInfo.viewportStartOffset +
(layoutInfo.viewportEndOffset - layoutInfo.viewportStartOffset) / 2

val itemInfo = layoutInfo.visibleItemsInfo.find { it.index == index }
val itemCenterOffset = itemInfo?.offset?.let { it + (itemInfo.size / 2) } ?: 0

val distanceFromCenter = abs(viewportCenterOffset - itemCenterOffset)
val maxDistance = totalItemHeight.toPx() * visibleItemsMiddle

alpha = if (distanceFromCenter <= maxDistance) {
((maxDistance - distanceFromCenter) / maxDistance).coerceIn(0.2f, 1f)
} else {
0.2f
}

scaleY = 1f - (0.2f * (distanceFromCenter / maxDistance)).coerceIn(0f, 0.4f)
}
.onSizeChanged { size -> itemHeightPixels = size.height }
.then(textModifier),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ package com.yapp.ui.component.timepicker
import androidx.compose.foundation.lazy.LazyListState
import androidx.compose.foundation.lazy.rememberLazyListState
import androidx.compose.runtime.Composable
import androidx.compose.runtime.Stable
import androidx.compose.runtime.remember
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow

@Stable
class PickerState<T>(
val lazyListState: LazyListState,
val initialIndex: Int,
Expand Down
14 changes: 7 additions & 7 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ versionCode = "1"
android-gradle-plugin = "8.7.2"

## Kotlin Symbol Processing
ksp = "2.0.0-1.0.22"
ksp = "2.2.21-2.0.4"

## Formatting Plugins
ktlint = "11.5.1"

## Kotlin Versions
kotlin = "2.0.0"
kotlin = "2.2.21"
kotlinx-serialization-json = "1.7.0"
kotlinx-coroutines = "1.9.0-RC"
kotlinx-collections = "0.3.7"
Expand All @@ -43,9 +43,9 @@ compose-ui = "1.7.6"
activity-compose = "1.9.3"

## Hilt
hilt = "2.51.1"
hilt-navigation-compose = "1.2.0"
hilt-work = "1.2.0"
hilt = "2.57.2"
hilt-navigation-compose = "1.3.0"
hilt-work = "1.3.0"

## Third Party
okhttp = "4.12.0"
Expand Down Expand Up @@ -74,11 +74,11 @@ timber = "5.0.1"
orbit = "6.1.0"
espressoCore = "3.6.1"
material = "1.12.0"
process-pheonix = "3.0.0"
lottie = "6.1.0"
accompanist = "0.37.0"
materialAndroid = "1.7.5"
amplitude = "1.20.3"
stability-analyzer = "0.4.2"

[libraries]

Expand Down Expand Up @@ -170,7 +170,6 @@ androidx-test-core = { group = "androidx.test", name = "core", version.ref = "an
androidx-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" }
material = { group = "com.google.android.material", name = "material", version.ref = "material" }

process-phoenix = { module = "com.jakewharton:process-phoenix", version.ref = "process-pheonix" }
lottie-compose = { group = "com.airbnb.android", name = "lottie-compose", version.ref= "lottie" }
accompanist-permission = { module = "com.google.accompanist:accompanist-permissions", version.ref = "accompanist" }
androidx-material-android = { group = "androidx.compose.material", name = "material-android", version.ref = "materialAndroid" }
Expand All @@ -196,3 +195,4 @@ compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "
google-service = { id = "com.google.gms.google-services", version.ref = "google-service" }
firebase-app-distribution = { id = "com.google.firebase.appdistribution", version.ref = "firebase-app-distribution" }
firebase-crashlytics = { id = "com.google.firebase.crashlytics", version.ref = "firebase-crashlytics" }
stability-analyzer = { id = "com.github.skydoves.compose.stability.analyzer", version.ref = "stability-analyzer" }