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

listener and target not being executed when load animated images #2453

Closed
SofiaTejerina opened this issue Aug 23, 2024 · 1 comment
Closed

Comments

@SofiaTejerina
Copy link

Describe the bug
I'm trying to run things using both listener and target but they don't run when I use a gif image or an animated webp for example, formats like jpg do work fine.

To Reproduce

val builder = ImageRequest.Builder(context = context.applicationContext)
            .data(data = url)
            .memoryCacheKey(key = url.toString())
            .diskCacheKey(key = url.toString())

builder.target(view)

builder.crossfade(enable = true)
builder.crossfade(durationMillis = 500)
builder.transitionFactory(transition = CrossfadeTransition.Factory())
builder.dispatcher(dispatcher = Dispatchers.IO)
builder.allowConversionToBitmap(enable = false)
builder.decoderFactory(factory = ImageDecoderDecoder.Factory())

builder.listener { _, result ->
     Log.i("Test", result)
}
    .target(target = object : ImageViewTarget(imageView) {
            override fun onStart(placeholder: Drawable?) {
                super.onStart(placeholder = placeholder)
                Log.i("Test", result)
            }

            override fun onSuccess(result: Drawable) {
                super.onSuccess(result = result)
                Log.i("Test", result)
            }

            override fun onError(error: Drawable?) {
                super.onError(error = error)
                Log.i("Test", result)
            }
})
imageLoader(context.applicationContext).enqueue(builder.build())

Logs/Screenshots
If applicable, add logs or screenshots to help explain your problem.

I found this that could be related with my issue but didn't help me:
#606
#676

Version
I'm using coil 2.6.0

Thanks! 🙌

@colinrtwhite
Copy link
Member

Sorry I can't provide 1:1 support for this kind of issue. I'd make sure that Animatable.start is being called on your Drawable. Also it sounds like you might want to use onAnimationStart/End instead of a regular listener.

@colinrtwhite colinrtwhite closed this as not planned Won't fix, can't repro, duplicate, stale Aug 23, 2024
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

2 participants