Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package com.example.jetcaster.designsystem.component
import androidx.compose.foundation.text.selection.SelectionContainer
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.text.AnnotatedString
import androidx.compose.ui.text.fromHtml

Expand All @@ -27,11 +28,11 @@ import androidx.compose.ui.text.fromHtml
* annotated string from [text], and enable text selection if [text] has any selectable element.
*/
@Composable
fun HtmlTextContainer(text: String, content: @Composable (AnnotatedString) -> Unit) {
fun HtmlTextContainer(text: String, modifier: Modifier = Modifier, content: @Composable (AnnotatedString) -> Unit) {
val annotatedString = remember(key1 = text) {
AnnotatedString.fromHtml(htmlString = text)
}
SelectionContainer {
SelectionContainer(modifier = modifier) {
content(annotatedString)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ import androidx.wear.compose.material3.PlaceholderState
import androidx.wear.compose.material3.ScreenScaffold
import androidx.wear.compose.material3.SurfaceTransformation
import androidx.wear.compose.material3.Text
import androidx.wear.compose.material3.TextDefaults
import androidx.wear.compose.material3.lazy.TransformationSpec
import androidx.wear.compose.material3.lazy.rememberTransformationSpec
import androidx.wear.compose.material3.lazy.transformedHeight
Expand Down Expand Up @@ -298,7 +299,13 @@ private fun TransformingLazyColumnScope.episodeInfoContent(episode: PlayerEpisod
if (summary != null) {
val summaryInParagraphs = summary.split("\n+".toRegex()).orEmpty()
items(summaryInParagraphs) {
HtmlTextContainer(text = summary) {
HtmlTextContainer(
text = it,
modifier = Modifier.minimumVerticalContentPadding(
TextDefaults.minimumTopListContentPadding,
TextDefaults.minimumBottomListContentPadding,
),
) {
Comment thread
kul3r4 marked this conversation as resolved.
Text(
text = it,
style = MaterialTheme.typography.bodySmall,
Expand Down
Loading