hitanshu-dhawan/SpannableStringParser

Add support for image span

Zkffkah opened this issue · 2 comments

It seems it doesn't support image span currently, any plan for it?

Hi @lowwor, this library only focus on textual properties (e.g. color, size, font etc.)
This allows us to configure our SpannableString from a back-end server without any app change, this may not be possible in case of ImageSpan as it requires us to have an image source burned into the app.

There are no plans for supporting ImageSpan as of now, but you can always add your custom spans using spanner lambda depending on your use-case.

Something like this...

spanner { property, value ->
    when (property) {
        "image" -> {
            // TODO : Use `value` here to get your image and return an ImageSpan
            return@spanner ImageSpan(...)
        }
    }
    return@spanner null
}

Got it, thanks!