Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GlideImage flashing #5468

Open
fanyafeng opened this issue Dec 27, 2024 · 0 comments
Open

GlideImage flashing #5468

fanyafeng opened this issue Dec 27, 2024 · 0 comments

Comments

@fanyafeng
Copy link

GlideImage flashing

Glide Version:
implementation("com.github.bumptech.glide:compose:1.0.0-beta01")
implementation("com.github.bumptech.glide:glide:5.0.0-rc01")
platform("androidx.compose:compose-bom:2024.09.00")

Integration libraries:
api(platform("com.squareup.okhttp3:okhttp-bom:4.12.0"))

Device/Android Version:
samsung SM-S908E/DS Android 13 One UI5.0
samsung SM-A5460 Android 14 One UI6.1
I also tried some other devices of my colleagues, and it was the same

Issue details / Repro steps / Use case background:
When I use GlideImage in compose, when my application is on the home page, there are two tabs switching back and forth. Under the premise that the current tab has loaded the image and there is a cache, the image will continue to be reloaded when switching back again, causing the screen flashing problem. However, when I use Coil, there is no such phenomenon. Is there any special setting required?
the video:

20241227-151928.mp4

Glide load line / GlideModule (if any) / list Adapter code (if any):

        GlideImage(
            model = model,
            contentDescription = model.toString(),
            modifier = modifier,
            clipToBounds = true,
//            failure = failure,
//            loading = placeholder(rememberDrawable),
            alignment = alignment,
            alpha = alpha,
            colorFilter = colorFilter,
            contentScale = contentScale,
            requestBuilderTransform = { requestBuilder ->
                requestBuilderTransform(
                    requestBuilder.addListener(object : RequestListener<Drawable> {
                        override fun onLoadFailed(e: GlideException?, model: Any?, target: Target<Drawable>, isFirstResource: Boolean): Boolean {
                            isLoading = false
                            onError?.invoke()
                            return false
                        }

                        override fun onResourceReady(resource: Drawable, model: Any, target: Target<Drawable>?, dataSource: DataSource, isFirstResource: Boolean): Boolean {
                            safeDebug {
                                Log.d("GlideImageWithColorfulSkeleton", "model:" + model.toString() + "  isFirstResource:" + isFirstResource)
                            }
                            rememberDrawable = resource
                            onSuccess?.invoke()
                            isLoading = false
                            return false
                        }
                    }).diskCacheStrategy(DiskCacheStrategy.ALL).skipMemoryCache(false).dontAnimate().placeholder(rememberDrawable)
                )
            }
        )

I use GlideImage in compose, So this item is empty

Stack trace / LogCat:

paste stack trace and/or log here
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant