-
Notifications
You must be signed in to change notification settings - Fork 174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update multiple-links snippet #352
Conversation
…ontent/support-multiple-links?hl=en (Multiple links in a text string) from deprecated pushStringAnnotation() to currently supported withLink().
…ontent/support-multiple-links?hl=en (Multiple links in a text string) from deprecated pushStringAnnotation() to currently supported withLink().
…ontent/support-multiple-links?hl=en (Multiple links in a text string) from deprecated pushStringAnnotation() to currently supported withLink().
…ontent/support-multiple-links?hl=en (Multiple links in a text string) from deprecated pushStringAnnotation() to currently supported withLink().
Text( | ||
buildAnnotatedString { | ||
append("Build better apps faster with ") | ||
append("Go to the ") | ||
withLink( | ||
LinkAnnotation.Url( | ||
"https://developer.android.com/jetpack/compose", | ||
"https://developer.android.com/", | ||
TextLinkStyles(style = SpanStyle(color = Color.Blue)) | ||
) | ||
) { | ||
append("Jetpack Compose") | ||
append("Android Developers ") | ||
pop() | ||
append("website, and check out the") | ||
} | ||
withLink( | ||
LinkAnnotation.Url( | ||
"https://developer.android.com/jetpack/compose", | ||
TextLinkStyles(style = SpanStyle(color = Color.Green)) | ||
) | ||
) { | ||
append("Compose guidance") | ||
pop() | ||
append(".") | ||
pop() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You dont need the pop
operations here, just move the non-linked text out of the withLink() {} lambda.
Text(
buildAnnotatedString {
append("Go to the ")
withLink(
LinkAnnotation.Url(
"https://developer.android.com/",
TextLinkStyles(style = SpanStyle(color = Color.Blue))
)
) {
append("Android Developers ")
}
append("website, and check out the")
withLink(
LinkAnnotation.Url(
"https://developer.android.com/jetpack/compose",
TextLinkStyles(style = SpanStyle(color = Color.Green))
)
) {
append("Compose guidance")
}
append(".")
}
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, nice, thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove pop operations.
…te-multiple-links # Conflicts: # compose/snippets/src/main/java/com/example/compose/snippets/text/TextSnippets.kt
Not sure what to do about this. |
fixed it for you |
No description provided.