https://kotlinlang.org logo
#compose
Title
# compose
s

Siyamed

04/15/2020, 11:30 PM
Hi all! I wondered if any of you had any issues or suggestions related to multi-style text (AnnotatedString and its builder)?
m

molikto

04/16/2020, 1:36 AM
1. currently there seems no way to insert an image within a AnnotatedString?
s

Siyamed

04/16/2020, 1:38 AM
Yes there is not. We think that it should not. AnnotatedString in current plans will contain annotations (markers). Compared to what we have on android where Spanned accepts all kinds of objects
The API to have an inline image is soon though. (I.e. custom inline emoji similar to K
🙏 3
m

molikto

04/16/2020, 1:40 AM
thx! there isn't an
2
though....
🙂 1
z

Zach Klippenstein (he/him) [MOD]

04/16/2020, 2:55 AM
I think someone on the team mentioned earlier that links (which is really just making certain ranges of text clickable) would also be done a different way than we’re used to with Spanned?
s

Siyamed

04/16/2020, 2:55 AM
It is on its way as well. The code will be on widget but not attached to AnnotatedString. Highly experimental :)
(The code to handle click)
z

Zach Klippenstein (he/him) [MOD]

04/16/2020, 3:02 AM
What about more advanced formatting, like the
Html.fromHtml
method, or this example of formatting bullet points with a custom span? https://github.com/googlearchive/android-text/blob/master/TextStyling-Java/app/src/main/java/com/android/example/text/styling/renderer/spans/BulletPointSpan.java
s

Siyamed

04/16/2020, 3:04 AM
I do not know bullets. We will have a way to provide bullets but is it in text or not i don't know. Overall we categorized bullets, margins, dropcap etc as paragraph styling.
👍 1
One of the things i dislike about curent textview/edittext is that they try to have another layout system for text.
The things to support doesnt end. (Tables, images, paragraphs) and it is close to impossible to make it performant
z

Zach Klippenstein (he/him) [MOD]

04/16/2020, 3:06 AM
Yea, that makes sense.
I actually tried implementing bullet point rendering using the
Table
composable and not only was it pretty straightforward to do, but text selection seemed to Just Work across different
Text
“instances”, which seemed like magic.
👍 1
I’ve also noticed that multiple text instances get grouped into the same semantics. I really like how it opens up the possibility to build complex custom text layouts that “look” like one big fancy text block to screen readers, selection, etc.
👍 1
Anyhoo, getting off topic, sorry.
😆 1
2 Views