Coil: Does Coil load into Drawable?

Created on 25 Mar 2020  路  5Comments  路  Source: coil-kt/coil

I currently have the issue that I need to render html with images into TextViews.
This is possible with the Html.ImageGetter.
However when I load the html the images are not loaded yet, so I display a placeholder as image and want to load the images by triggering coil. I can do this by using a drawable that first displayes a placeholder and then render into that drawable later with the image loaded by coil.
What I've seen so far is that people created their own DrawablePlaceholder where an arbitrary image loading mechanism could render the image into:
https://gist.github.com/rajeefmk/beb1b79363c12041da7fd540bcf27765

However I wonder if Coil already has such a Drawable placeholder?

question

Most helpful comment

:D thank you Same goes to you guys :)

All 5 comments

Or to make it more human understandibly: I want a way that Coil can render asynchronously into a drawable.

Ah just use Kotlin coroutines and Coil.get().
Uff I'm new to kotlin

You can implement a custom Target and set the placeholder for your request using LoadRequestBuilder.placeholder. The result should be pretty similar to the Picasso gist you linked.

BTW @theScrabi , big fan of your work on NewPipe 馃槃 Here is an implementation of an Html.Getter that I created and am using in a few projects:

https://github.com/Commit451/coil-imagegetter

:D thank you Same goes to you guys :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mario picture mario  路  3Comments

digitalheir picture digitalheir  路  4Comments

GeniusRUS picture GeniusRUS  路  4Comments

vegeta2102 picture vegeta2102  路  6Comments

adesamp picture adesamp  路  3Comments