diff --git a/app/src/main/java/com/spoony/spoony/core/designsystem/component/card/ReviewCard.kt b/app/src/main/java/com/spoony/spoony/core/designsystem/component/card/ReviewCard.kt index a977f525c..a8c719432 100644 --- a/app/src/main/java/com/spoony/spoony/core/designsystem/component/card/ReviewCard.kt +++ b/app/src/main/java/com/spoony/spoony/core/designsystem/component/card/ReviewCard.kt @@ -173,7 +173,8 @@ private fun ImageGrid( .aspectRatio(1f), shape = RoundedCornerShape(imageRadius), contentScale = ContentScale.Crop, - contentDescription = null + contentDescription = null, + showLoadingIndicator = true ) } } diff --git a/app/src/main/java/com/spoony/spoony/core/designsystem/component/image/SpoonyImage.kt b/app/src/main/java/com/spoony/spoony/core/designsystem/component/image/SpoonyImage.kt index 4834f5bbc..ab4e80c03 100644 --- a/app/src/main/java/com/spoony/spoony/core/designsystem/component/image/SpoonyImage.kt +++ b/app/src/main/java/com/spoony/spoony/core/designsystem/component/image/SpoonyImage.kt @@ -1,7 +1,11 @@ package com.spoony.spoony.core.designsystem.component.image import androidx.compose.foundation.Image +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.material3.CircularProgressIndicator import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip import androidx.compose.ui.graphics.RectangleShape @@ -10,8 +14,10 @@ import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.layout.ContentScale import androidx.compose.ui.platform.LocalInspectionMode import androidx.compose.ui.res.vectorResource -import coil3.compose.AsyncImage +import coil3.compose.SubcomposeAsyncImage +import coil3.compose.SubcomposeAsyncImageContent import com.spoony.spoony.R +import com.spoony.spoony.core.designsystem.theme.SpoonyAndroidTheme @Composable fun SpoonyImage( @@ -19,7 +25,8 @@ fun SpoonyImage( modifier: Modifier = Modifier, shape: Shape = RectangleShape, contentScale: ContentScale = ContentScale.Crop, - contentDescription: String? = null + contentDescription: String? = null, + showLoadingIndicator: Boolean = false ) { if (LocalInspectionMode.current) { Image( @@ -29,11 +36,31 @@ fun SpoonyImage( modifier = modifier.clip(shape) ) } else { - AsyncImage( + SubcomposeAsyncImage( model = model, contentDescription = contentDescription, contentScale = contentScale, - modifier = modifier.clip(shape) + modifier = modifier.clip(shape), + loading = { + if (showLoadingIndicator) { + LoadingIndicator() + } + }, + success = { + SubcomposeAsyncImageContent() + } + ) + } +} + +@Composable +private fun LoadingIndicator() { + Box( + modifier = Modifier.fillMaxSize(), + contentAlignment = Alignment.Center + ) { + CircularProgressIndicator( + color = SpoonyAndroidTheme.colors.gray300 ) } } diff --git a/app/src/main/java/com/spoony/spoony/presentation/exploreSearch/component/ExploreSearchUserItem.kt b/app/src/main/java/com/spoony/spoony/presentation/exploreSearch/component/ExploreSearchUserItem.kt index 0a8da5786..7fc154c42 100644 --- a/app/src/main/java/com/spoony/spoony/presentation/exploreSearch/component/ExploreSearchUserItem.kt +++ b/app/src/main/java/com/spoony/spoony/presentation/exploreSearch/component/ExploreSearchUserItem.kt @@ -42,7 +42,8 @@ fun ExploreSearchUserItem( modifier = Modifier.size(48.dp), shape = CircleShape, contentScale = ContentScale.Crop, - contentDescription = null + contentDescription = null, + showLoadingIndicator = true ) Spacer(modifier = Modifier.width(14.dp)) Column { diff --git a/app/src/main/java/com/spoony/spoony/presentation/gourmet/map/component/MapPlaceDetailCard.kt b/app/src/main/java/com/spoony/spoony/presentation/gourmet/map/component/MapPlaceDetailCard.kt index 98ede6fbf..1bfefd26e 100644 --- a/app/src/main/java/com/spoony/spoony/presentation/gourmet/map/component/MapPlaceDetailCard.kt +++ b/app/src/main/java/com/spoony/spoony/presentation/gourmet/map/component/MapPlaceDetailCard.kt @@ -67,7 +67,8 @@ fun MapPlaceDetailCard( model = url, modifier = Modifier .height(103.dp) - .weight(1f) + .weight(1f), + showLoadingIndicator = true ) } } diff --git a/app/src/main/java/com/spoony/spoony/presentation/placeDetail/component/PlaceDetailImageLazyRow.kt b/app/src/main/java/com/spoony/spoony/presentation/placeDetail/component/PlaceDetailImageLazyRow.kt index 4621d943f..ffe53a7e4 100644 --- a/app/src/main/java/com/spoony/spoony/presentation/placeDetail/component/PlaceDetailImageLazyRow.kt +++ b/app/src/main/java/com/spoony/spoony/presentation/placeDetail/component/PlaceDetailImageLazyRow.kt @@ -36,7 +36,8 @@ fun PlaceDetailImageLazyRow( model = imageUrl, shape = RoundedCornerShape(10.dp), contentScale = ContentScale.Crop, - contentDescription = null + contentDescription = null, + showLoadingIndicator = true ) } } diff --git a/app/src/main/java/com/spoony/spoony/presentation/register/component/PhotoPicker.kt b/app/src/main/java/com/spoony/spoony/presentation/register/component/PhotoPicker.kt index 691cb5123..8fd670dca 100644 --- a/app/src/main/java/com/spoony/spoony/presentation/register/component/PhotoPicker.kt +++ b/app/src/main/java/com/spoony/spoony/presentation/register/component/PhotoPicker.kt @@ -159,7 +159,8 @@ fun PhotoPicker( model = photo.uri, modifier = Modifier.fillMaxSize(), shape = RoundedCornerShape(8.dp), - contentScale = ContentScale.Crop + contentScale = ContentScale.Crop, + showLoadingIndicator = true ) Icon( imageVector = ImageVector.vectorResource(id = R.drawable.ic_delete_filled_24),