diff --git a/ui/common/src/main/java/org/kafka/common/extensions/elevation.kt b/ui/common/src/main/java/org/kafka/common/extensions/elevation.kt index 114d98cee..c158d9af0 100644 --- a/ui/common/src/main/java/org/kafka/common/extensions/elevation.kt +++ b/ui/common/src/main/java/org/kafka/common/extensions/elevation.kt @@ -4,12 +4,14 @@ import androidx.compose.foundation.lazy.LazyListState import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp -val LazyListState.elevation: Dp - get() = if (firstVisibleItemIndex == 0) { - // For the first element, use the minimum of scroll offset and default elevation - // i.e. a value between 0 and 4.dp - minOf(firstVisibleItemScrollOffset.toFloat().dp, 24.dp) - } else { - // If not the first element, always set elevation and show the shadow - 24.dp - } +object Elevation { + val LazyListState.elevation: Dp + get() = if (firstVisibleItemIndex == 0) { + // For the first element, use the minimum of scroll offset and default elevation + // i.e. a value between 0 and 4.dp + minOf(firstVisibleItemScrollOffset.toFloat().dp, 24.dp) + } else { + // If not the first element, always set elevation and show the shadow + 24.dp + } +} diff --git a/ui/homepage/src/main/java/org/kafka/homepage/recent/RecentScreen.kt b/ui/homepage/src/main/java/org/kafka/homepage/recent/RecentScreen.kt index db45f7edc..f4c022438 100644 --- a/ui/homepage/src/main/java/org/kafka/homepage/recent/RecentScreen.kt +++ b/ui/homepage/src/main/java/org/kafka/homepage/recent/RecentScreen.kt @@ -16,7 +16,7 @@ import androidx.hilt.navigation.compose.hiltViewModel import androidx.lifecycle.compose.collectAsStateWithLifecycle import com.kafka.data.entities.RecentItem import kotlinx.collections.immutable.ImmutableList -import org.kafka.common.extensions.elevation +import org.kafka.common.extensions.Elevation.elevation import org.kafka.common.widgets.shadowMaterial import org.kafka.homepage.R import org.kafka.navigation.LocalNavigator diff --git a/ui/item/src/main/java/org/kafka/item/files/Files.kt b/ui/item/src/main/java/org/kafka/item/files/Files.kt index 820deec33..cad02e46a 100644 --- a/ui/item/src/main/java/org/kafka/item/files/Files.kt +++ b/ui/item/src/main/java/org/kafka/item/files/Files.kt @@ -16,7 +16,7 @@ import androidx.hilt.navigation.compose.hiltViewModel import androidx.lifecycle.compose.collectAsStateWithLifecycle import com.kafka.data.entities.File import kotlinx.coroutines.CoroutineScope -import org.kafka.common.extensions.elevation +import org.kafka.common.extensions.Elevation.elevation import org.kafka.common.test.testTagUi import org.kafka.common.widgets.shadowMaterial import org.kafka.navigation.LocalNavigator