From c8873052f928ce5e37bd4ab55297358717cc6bce Mon Sep 17 00:00:00 2001 From: Luca Nicoletti Date: Tue, 19 Mar 2024 13:36:53 +0000 Subject: [PATCH] Add capability to handle unordered list --- README.md | 6 ++++++ art/ul-screenshot.png | Bin 0 -> 35616 bytes .../compose/htmltext/example/MainActivity.kt | 8 ++++++++ .../de/charlex/compose/material/HtmlText.kt | 12 +++++++++++- .../de/charlex/compose/material3/HtmlText.kt | 12 +++++++++++- 5 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 art/ul-screenshot.png diff --git a/README.md b/README.md index 7fa7e62..4b59b25 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,11 @@ Text composable to show html text from resources <font color="#FF0000"> - Colored text (Markdown does not allow a preview here)
<font color="red"> - Colored text (Markdown does not allow a preview here)

+**Additional**
+<ul><li></li></ul> - Unordered lists + • Item + • Item + ## MaterialTheme colors in HtmlText To use colors like `MaterialTheme.colors.primary` in `HtmlText`, map simple colors. ```kotlin @@ -93,6 +98,7 @@ HtmlText(textId = R.string.hello_world) # Preview ![HtmlText](https://github.com/ch4rl3x/HtmlText/blob/main/art/screenshot.png) +![HtmlText with unordered list](https://github.com/ch4rl3x/HtmlText/blob/main/art/ul-screenshot.png) That's it! diff --git a/art/ul-screenshot.png b/art/ul-screenshot.png new file mode 100644 index 0000000000000000000000000000000000000000..b5731dd4fda9db54b39522e30f2fab3ead1e70a7 GIT binary patch literal 35616 zcmeEv2{e^^+jnW66NQlCgb107*ebSCrc6aB^DLP%?wn4M3>89RD-A}(k}9-=x8{wA~1 zMEq6Bb~f!TT%$Mc1%eN4YZD(#;Nx95uUb1G5JZ8J8`b{m( zmUZVDnJ3NFk7aLI=)$>qb@6u&CFXVNH$P7$SCOA|x7WB==I1J}$xYCSVBZz5S@Dgm&TIN> zqgfS5g|l6L8qZV$4?Ff(9~(*UzOlk*!~VU-VvlZ~HbyOK@He@!fcm%FFl+;~j{~wg zN$k&}U35dMRL@$mH@!X%JYvw~J@Jl7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Ir<-N?fxLUpkI zk~UXfU~-G6XJ9G*^0A9awnR50}JrEwB_L@C_*jK}#?%vJ}>T zbI5tASd7QEfQ5JZPRL+>m;4d1@ax6OtLM*p_;?DkaDOKbvrHSyYeiq&mPiqT_U?oP O{8^Y;o6`5Voc|~B&nEH! literal 0 HcmV?d00001 diff --git a/example/src/main/java/de/charlex/compose/htmltext/example/MainActivity.kt b/example/src/main/java/de/charlex/compose/htmltext/example/MainActivity.kt index f6a4253..32cb49e 100644 --- a/example/src/main/java/de/charlex/compose/htmltext/example/MainActivity.kt +++ b/example/src/main/java/de/charlex/compose/htmltext/example/MainActivity.kt @@ -32,6 +32,7 @@ class MainActivity : ComponentActivity() { MultipleLinks() ReturnLink() ReturnLinks() + UnorderedList() } } } @@ -120,3 +121,10 @@ fun ReturnLinks() { } ) } + +@Composable +fun UnorderedList() { + HtmlText( + text = "Unordered list
  • Item
  • Item
  • Item
  • ", + ) +} diff --git a/material-html-text/src/main/java/de/charlex/compose/material/HtmlText.kt b/material-html-text/src/main/java/de/charlex/compose/material/HtmlText.kt index 52f8c9f..b40edd7 100644 --- a/material-html-text/src/main/java/de/charlex/compose/material/HtmlText.kt +++ b/material-html-text/src/main/java/de/charlex/compose/material/HtmlText.kt @@ -3,7 +3,9 @@ package de.charlex.compose.material import android.graphics.Typeface import android.os.Build.VERSION.SDK_INT import android.text.Html +import android.text.SpannableStringBuilder import android.text.Spanned +import android.text.style.BulletSpan import android.text.style.ForegroundColorSpan import android.text.style.StrikethroughSpan import android.text.style.StyleSpan @@ -42,6 +44,7 @@ import androidx.compose.ui.text.style.TextDecoration import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.TextUnit import androidx.core.text.getSpans +import androidx.core.text.toSpannable /** * Simple Text composable to show the text with html styling from string resources. @@ -312,7 +315,14 @@ fun Spanned.toAnnotatedString( colorMapping: Map = emptyMap(), ): AnnotatedString { return buildAnnotatedString { - append(this@toAnnotatedString.toString()) + val bulletSpans = getSpans() + val spannableStringBuilder = SpannableStringBuilder.valueOf(this@toAnnotatedString) + bulletSpans.forEach { bulletSpan -> + val start = getSpanStart(bulletSpan) + spannableStringBuilder.insert(start, " • ") + spannableStringBuilder.removeSpan(bulletSpan) + } + append(spannableStringBuilder.toSpannable()) val urlSpans = getSpans() val styleSpans = getSpans() val colorSpans = getSpans() diff --git a/material3-html-text/src/main/java/de/charlex/compose/material3/HtmlText.kt b/material3-html-text/src/main/java/de/charlex/compose/material3/HtmlText.kt index 8d91fde..894276b 100644 --- a/material3-html-text/src/main/java/de/charlex/compose/material3/HtmlText.kt +++ b/material3-html-text/src/main/java/de/charlex/compose/material3/HtmlText.kt @@ -3,7 +3,9 @@ package de.charlex.compose.material3 import android.graphics.Typeface import android.os.Build.VERSION.SDK_INT import android.text.Html +import android.text.SpannableStringBuilder import android.text.Spanned +import android.text.style.BulletSpan import android.text.style.ForegroundColorSpan import android.text.style.StrikethroughSpan import android.text.style.StyleSpan @@ -42,6 +44,7 @@ import androidx.compose.ui.text.style.TextDecoration import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.TextUnit import androidx.core.text.getSpans +import androidx.core.text.toSpannable /** * Simple Text composable to show the text with html styling from string resources. @@ -312,7 +315,14 @@ fun Spanned.toAnnotatedString( colorMapping: Map = emptyMap(), ): AnnotatedString { return buildAnnotatedString { - append(this@toAnnotatedString.toString()) + val bulletSpans = getSpans() + val spannableStringBuilder = SpannableStringBuilder.valueOf(this@toAnnotatedString) + bulletSpans.forEach { bulletSpan -> + val start = getSpanStart(bulletSpan) + spannableStringBuilder.insert(start, " • ") + spannableStringBuilder.removeSpan(bulletSpan) + } + append(spannableStringBuilder.toSpannable()) val urlSpans = getSpans() val styleSpans = getSpans() val colorSpans = getSpans()