I used this (not so nice anymore) example to enable linkification on my Android Jetpack Compose Text composable (see section with "The ClickableText handles link on text").
That works so far easy and nice for one language. As you can see in the AnnotatedString.Builder:
addStyle(
style = SpanStyle(
textDecoration = TextDecoration.Underline
),
start = 8,
end = 15
)
addStringAnnotation(
tag = uriTag,
annotation = "https://developer.android.com/jetpack/compose",
start = 8,
end = 15
)
I have to enter start and end indices to highlight the link by underlines. Imagine I have multiple string language resources and I only want to linkify website or Webseite:
"My website"
"Meine Webseite"
The upper english string would have start and end indices from 4 to 10.
Lower german string would have 7 to 14. This is for multiple language resources not very usable. How can I linkify my Text composable more easily, without calculating indices.
(Please note: I want to use natural libraries andoridx.* kotlin.* only. Other 3rd party libraries will be ignored)