Skip to content

Commit 831e1f6

Browse files
authored
Merge pull request #352 from android/update-multiple-links
Update multiple-links snippet
2 parents c061f4c + e646af5 commit 831e1f6

File tree

1 file changed

+16
-5
lines changed
  • compose/snippets/src/main/java/com/example/compose/snippets/text

1 file changed

+16
-5
lines changed

compose/snippets/src/main/java/com/example/compose/snippets/text/TextSnippets.kt

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -555,18 +555,28 @@ private object TextEffectiveStateManagement2 {
555555
// [START android_compose_text_link_1]
556556
@Composable
557557
fun AnnotatedStringWithLinkSample() {
558-
// Display a link in the text
558+
// Display multiple links in the text
559559
Text(
560560
buildAnnotatedString {
561-
append("Build better apps faster with ")
561+
append("Go to the ")
562562
withLink(
563563
LinkAnnotation.Url(
564-
"https://developer.android.com/jetpack/compose",
564+
"https://developer.android.com/",
565565
TextLinkStyles(style = SpanStyle(color = Color.Blue))
566566
)
567567
) {
568-
append("Jetpack Compose")
568+
append("Android Developers ")
569569
}
570+
append("website, and check out the")
571+
withLink(
572+
LinkAnnotation.Url(
573+
"https://developer.android.com/jetpack/compose",
574+
TextLinkStyles(style = SpanStyle(color = Color.Green))
575+
)
576+
) {
577+
append("Compose guidance")
578+
}
579+
append(".")
570580
}
571581
)
572582
}
@@ -597,7 +607,7 @@ fun AnnotatedStringWithListenerSample() {
597607
// [END android_compose_text_link_2]
598608

599609
@Composable
600-
private fun TextSample(samples: Map<String, @Composable ()->Unit>) {
610+
private fun TextSample(samples: Map<String, @Composable () -> Unit>) {
601611
MaterialTheme {
602612
Box(
603613
Modifier
@@ -631,6 +641,7 @@ private const val SAMPLE_LONG_TEXT =
631641
"It simplifies and accelerates UI development on Android bringing your apps " +
632642
"to life with less code, powerful tools, and intuitive Kotlin APIs. " +
633643
"It makes building Android UI faster and easier."
644+
634645
@Composable
635646
@Preview
636647
fun LineBreakSample() {

0 commit comments

Comments
 (0)