You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello guys,
I'm using coil3 with ktor3.
I have a LazyGrid on Android TV with about 500 TV channels displaying a snapshot of the live TV image. This image is refreshed every 30s..
As the Android TV device are not very powerful, I'd like to put the image in cache for 30s so that when I scroll down/up, it keeps the cache version and navigate smoother than retrigger the image reload as it is in my current scenario above:
val request =ImageRequest.Builder(context)
.data(myImageUrl)
.crossfade(0)
.memoryCachePolicy(CachePolicy.DISABLED)
.diskCachePolicy(CachePolicy.DISABLED)
.build()
val painter = rememberAsyncImagePainter(
model = request
)
Image(
modifier =Modifier.fillMaxSize(),
contentScale =ContentScale.Crop,
alignment =Alignment.Center,
painter = painter,
contentDescription =null
)
LaunchedEffect(Unit) {
while (true) {
delay(30000L)
painter.restart()
}
}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello guys,
I'm using coil3 with ktor3.
I have a LazyGrid on Android TV with about 500 TV channels displaying a snapshot of the live TV image. This image is refreshed every 30s..
As the Android TV device are not very powerful, I'd like to put the image in cache for 30s so that when I scroll down/up, it keeps the cache version and navigate smoother than retrigger the image reload as it is in my current scenario above:
Beta Was this translation helpful? Give feedback.
All reactions