Skip to content

DrawableSource

Alexander Zhirkevich edited this page Sep 7, 2022 · 4 revisions

Source of android Drawable

fun interface DrawableSource {

    suspend fun get(context: Context) : Drawable
}

Methods

suspend fun get(context: Context) : Drawable

Get drawable using context

Default implementations

Implementation Description
DrawableSource.Empty Represents lack of Drawable
DrawableSource.Resource Get drawable from app drawable resources
DrawableSource.File Get drawable from android file system. App must have permission to read this file

Comments

It is fun interface. So, if you have direct Drawable instance, it can be easily wrapped to DrawableSource:

val source = DrawableSource { drawable }

Serialization will not work for this example

Clone this wiki locally