From 0d3aa1b52a8d4f02630be1d826a0292d76a01617 Mon Sep 17 00:00:00 2001 From: T8RIN Date: Sat, 30 Mar 2024 07:58:20 +0300 Subject: [PATCH] improve uris preview --- .../core/ui/widget/image/UrisPreview.kt | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/core/ui/src/main/kotlin/ru/tech/imageresizershrinker/core/ui/widget/image/UrisPreview.kt b/core/ui/src/main/kotlin/ru/tech/imageresizershrinker/core/ui/widget/image/UrisPreview.kt index 5c53ca30b8..b76336c802 100644 --- a/core/ui/src/main/kotlin/ru/tech/imageresizershrinker/core/ui/widget/image/UrisPreview.kt +++ b/core/ui/src/main/kotlin/ru/tech/imageresizershrinker/core/ui/widget/image/UrisPreview.kt @@ -18,6 +18,7 @@ package ru.tech.imageresizershrinker.core.ui.widget.image import android.net.Uri +import androidx.compose.animation.core.animateFloatAsState import androidx.compose.foundation.background import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Arrangement @@ -133,13 +134,21 @@ fun UrisPreview( modifier = Modifier .padding(4.dp) .clip(CircleShape) - .background(Color.Black.copy(0.2f)) - .clickable { + .background( + Color.Black.copy( + animateFloatAsState(if (uris.size > 1) 0.2f else 0f).value + ) + ) + .clickable( + enabled = uris.size > 1 + ) { onRemoveUri(uri) } .padding(4.dp) .align(Alignment.TopEnd), - tint = Color.White.copy(0.7f), + tint = Color.White.copy( + animateFloatAsState(if (uris.size > 1) 0.7f else 0f).value + ), ) val filename by remember(uri) { derivedStateOf {