mirror of
https://github.com/austinried/subtracks.git
synced 2026-11-10 23:21:59 +01:00
crossfade only the hero image, not the grid
This commit is contained in:
@@ -4,7 +4,6 @@ import android.app.Application
|
||||
import coil3.ImageLoader
|
||||
import coil3.SingletonImageLoader
|
||||
import coil3.network.okhttp.OkHttpNetworkFetcherFactory
|
||||
import coil3.request.crossfade
|
||||
import com.subtracks.di.appModule
|
||||
import okhttp3.OkHttpClient
|
||||
import org.koin.core.context.startKoin
|
||||
@@ -23,7 +22,6 @@ class SubtracksApp : Application() {
|
||||
ImageLoader
|
||||
.Builder(context)
|
||||
.components { add(OkHttpNetworkFetcherFactory(callFactory = { http })) }
|
||||
.crossfade(150)
|
||||
.build()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ import androidx.compose.ui.unit.dp
|
||||
import coil3.compose.AsyncImage
|
||||
import coil3.compose.LocalPlatformContext
|
||||
import coil3.request.ImageRequest
|
||||
import coil3.request.crossfade
|
||||
import com.subtracks.data.model.CoverArtRef
|
||||
|
||||
@Composable
|
||||
@@ -37,7 +38,7 @@ fun CoverArt(
|
||||
)
|
||||
if (thumbnailRef != null && thumbnailRef != ref) {
|
||||
AsyncImage(
|
||||
model = remember(thumbnailRef) { imageRequest(context, thumbnailRef) },
|
||||
model = remember(thumbnailRef) { imageRequest(context, thumbnailRef, crossfade = false) },
|
||||
contentDescription = null,
|
||||
contentScale = ContentScale.Crop,
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
@@ -45,7 +46,7 @@ fun CoverArt(
|
||||
}
|
||||
if (ref != null) {
|
||||
AsyncImage(
|
||||
model = remember(ref) { imageRequest(context, ref) },
|
||||
model = remember(ref) { imageRequest(context, ref, crossfade = thumbnailRef != null) },
|
||||
contentDescription = null,
|
||||
contentScale = ContentScale.Crop,
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
@@ -57,12 +58,14 @@ fun CoverArt(
|
||||
private fun imageRequest(
|
||||
context: Context,
|
||||
ref: CoverArtRef,
|
||||
crossfade: Boolean,
|
||||
): ImageRequest =
|
||||
ImageRequest
|
||||
.Builder(context)
|
||||
.data(ref.url)
|
||||
.memoryCacheKey(ref.cacheKey)
|
||||
.diskCacheKey(ref.cacheKey)
|
||||
.crossfade(crossfade)
|
||||
.build()
|
||||
|
||||
@Composable
|
||||
|
||||
Reference in New Issue
Block a user