Luis Daivid

    Luis Daivid

    1 year ago
    here is my code
    @Composable
    fun ImageItem(image: ImageModel, onClickImage: (ImageModel) -> Unit) {
        Surface(modifier = Modifier.clickable(onClick = { onClickImage(image) })) {
            Column {
                Box(
                ) {
                    GlideImage(
                        imageModel = image.imagePath.toUri(),
                        requestOptions = RequestOptions()
                            .override(500, 500)
                            .diskCacheStrategy(DiskCacheStrategy.ALL)
                    )
                }
                Text(text = image.name)
            }
        }
    }
    Andrey Kulikov

    Andrey Kulikov

    1 year ago
    i think the issue here is that the image is loading asynchronous and for free frames your item has zero size. this confuses the scrolling and dynamic item creations. it would be nice if you can set some fixed size for the items
    Luis Daivid

    Luis Daivid

    1 year ago
    @Andrey Kulikov Each image has different width and width, so it cannot be arbitrarily specified. What should I do?
    Andrey Kulikov

    Andrey Kulikov

    1 year ago
    maybe you can at least provide some min height?
    Luis Daivid

    Luis Daivid

    1 year ago
    I can apply min, but the problem still occurs.
    gildor

    gildor

    1 year ago
    It doesn't look like a problem unique for compose, Recycler View would have the same problem for such case To mitigate it, GlideImage could cache bitmap to memory (or at least size of it) and set it immediately, if it available, instead of doing async request Also, I would check that memory cache is enabled and images have reasonable size