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

bohregard

06/17/2020, 10:45 PM
So after reading through the slack regarding AnnotatedString, I have some questions 1. I know text composables can be clickable, but is it possible to have portions of the text clickable (ie for resolving links et cetera)? 2. Is it possible to expose the styles with their ranges on the AnnotatedString builder? I ask because if I’m building a string and I replace part of the string but I had already applied a style, the style does not shift with the removal of text (which is fine and makes sense that it wouldn’t). But it would be helpful to have access to the styles that have been appended up to this point to either remove them or offset them by the newly formatted string. (Say because I’m going through a set of rules and formatting text based on these rules)
z

Zach Klippenstein (he/him) [MOD]

06/17/2020, 10:49 PM
1. Yes, see
ClickableText
. 2. Agreed, it would be nice to have some more api for “mutating”
AnnotatedString
.
s

Siyamed

06/18/2020, 12:47 AM
SpannableStringBuilder imho was a mistake
We will have remove someday for an annotated string related construct
I dont want it to be AnnotatedString
But maybe ~MutableAnnotatedString
❤️ 2
As @Zach Klippenstein (he/him) [MOD] mentioned ClickableText is what we have right now. If you check the ClickableText code, with the current basic API it is a few lines of code
I want to deprecate ClickableText though :)
❤️ 2
b

bohregard

06/18/2020, 12:52 AM
Would the clickableText be replaced by something else?
A mutableAnnotatedString would be great imo
s

Siyamed

06/18/2020, 12:53 AM
I am working on the ways to get rid of ClickableText, correct
The reason is that it wraps Text and extending Text with a wrapper for every use case makes me scared a lot
Hyperlinks, clicks, long click, double click (and good amount of other use cases that i cannot remember)