Skip to content
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

Merged
merged 10 commits into from
Sep 25, 2024
Merged

Update multiple-links snippet #352

merged 10 commits into from
Sep 25, 2024

Conversation

thedmail
Copy link
Contributor

No description provided.

thedmail and others added 5 commits September 17, 2024 11:17
…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().
Comment on lines 554 to 576
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()
Copy link
Collaborator

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(".")
        }
    )

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, nice, thanks.

Copy link
Collaborator

@riggaroo riggaroo left a 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
@thedmail
Copy link
Contributor Author

Apply spotless / apply-spotless (pull_request) Failing after 1m

Not sure what to do about this.

@riggaroo
Copy link
Collaborator

Apply spotless / apply-spotless (pull_request) Failing after 1m

Not sure what to do about this.

fixed it for you

@thedmail thedmail merged commit 831e1f6 into main Sep 25, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants