If we are using LazyLayout with with lots of entri...
# compose
s
If we are using LazyLayout with with lots of entries in List and each List Card having a ImageView which displays Image from any URL. Now, We are using the GlideImage from Landscapist library. For Image part how does it work for displaying the images in ImageView from URL and when new views are visible on screen does it use image from cache or triggers recomposition of views
c
I'm not sure I really understand your question, but this seems like it'd be an internal implementation detail of Glide and not really anything compose related?
s
Copy code
@Composable
fun MyImageWrapper(
    modifier: Modifier = Modifier,
    imageUrl: String? = null,
    imageDrawable: Int? = null,
    contentScale: ContentScale = ContentScale.Crop,
    loadingDrawable: Int? = null,
    errorDrawable: Int? = null,
    alignment: Alignment = Alignment.Center,
    errorView: @Composable () -> Unit = {
        errorDrawable?.let {
            Image(
                painter = painterResource(id = errorDrawable),
                contentDescription = ""
            )
        }
    },
    loadingView: @Composable () -> Unit = {
        loadingDrawable?.let {
            Image(painter = painterResource(id = loadingDrawable), contentDescription = "")
        }
    }
) {
    GlideImage(modifier = modifier, imageModel = imageUrl ?: imageDrawable, loading = {
        loadingView()
    }, failure = {
        errorView()
    }, alignment = alignment, contentScale = contentScale, contentDescription = "")
}
If I am using this Composable for displaying Images for Item in LazyLayout, will it be optimised internally or I have to maintain states for Images etc to avoid recompositions is my query