@@ -41,6 +41,7 @@ import androidx.compose.foundation.layout.systemBarsPadding
41
41
import androidx.compose.foundation.layout.windowInsetsPadding
42
42
import androidx.compose.foundation.layout.wrapContentSize
43
43
import androidx.compose.foundation.rememberScrollState
44
+ import androidx.compose.foundation.text.selection.SelectionContainer
44
45
import androidx.compose.foundation.verticalScroll
45
46
import androidx.compose.material.icons.Icons
46
47
import androidx.compose.material.icons.automirrored.filled.ArrowBack
@@ -55,6 +56,7 @@ import androidx.compose.material.icons.rounded.PlayCircleFilled
55
56
import androidx.compose.material3.CircularProgressIndicator
56
57
import androidx.compose.material3.Icon
57
58
import androidx.compose.material3.IconButton
59
+ import androidx.compose.material3.LocalContentColor
58
60
import androidx.compose.material3.MaterialTheme
59
61
import androidx.compose.material3.Slider
60
62
import androidx.compose.material3.Surface
@@ -73,11 +75,13 @@ import androidx.compose.ui.semantics.Role
73
75
import androidx.compose.ui.semantics.role
74
76
import androidx.compose.ui.semantics.semantics
75
77
import androidx.compose.ui.text.TextStyle
78
+ import androidx.compose.ui.text.buildAnnotatedString
76
79
import androidx.compose.ui.text.style.TextOverflow
77
80
import androidx.compose.ui.tooling.preview.Devices
78
81
import androidx.compose.ui.tooling.preview.Preview
79
82
import androidx.compose.ui.unit.Dp
80
83
import androidx.compose.ui.unit.dp
84
+ import androidx.core.text.HtmlCompat
81
85
import androidx.hilt.navigation.compose.hiltViewModel
82
86
import androidx.window.core.layout.WindowSizeClass
83
87
import androidx.window.core.layout.WindowWidthSizeClass
@@ -486,19 +490,16 @@ private fun PlayerContentBookStart(
486
490
.fillMaxSize()
487
491
.verticalScroll(rememberScrollState())
488
492
.padding(
489
- vertical = 8 .dp,
493
+ vertical = 40 .dp,
490
494
horizontal = 16 .dp
491
495
),
492
496
horizontalAlignment = Alignment .CenterHorizontally ,
493
- verticalArrangement = Arrangement .SpaceAround
494
497
) {
495
- Spacer (modifier = Modifier .height(32 .dp))
496
498
PodcastInformation (
497
- episode.title,
498
- episode.podcastName,
499
- episode.summary
499
+ title = episode.title,
500
+ name = episode.podcastName,
501
+ summary = episode.summary,
500
502
)
501
- Spacer (modifier = Modifier .height(32 .dp))
502
503
}
503
504
}
504
505
@@ -618,32 +619,32 @@ private fun PodcastInformation(
618
619
title : String ,
619
620
name : String ,
620
621
summary : String ,
622
+ modifier : Modifier = Modifier ,
621
623
titleTextStyle : TextStyle = MaterialTheme .typography.headlineSmall,
622
624
nameTextStyle : TextStyle = MaterialTheme .typography.displaySmall,
623
625
) {
624
626
Column (
627
+ modifier = modifier.padding(horizontal = 8 .dp),
628
+ verticalArrangement = Arrangement .spacedBy(32 .dp),
625
629
horizontalAlignment = Alignment .CenterHorizontally ,
626
- modifier = Modifier .padding(horizontal = 8 .dp)
627
630
) {
628
631
Text (
629
632
text = name,
630
633
style = nameTextStyle,
631
634
maxLines = 1 ,
632
635
overflow = TextOverflow .Ellipsis
633
636
)
634
- Spacer (modifier = Modifier .height(32 .dp))
635
637
Text (
636
638
text = title,
637
639
style = titleTextStyle,
638
640
maxLines = 1 ,
639
641
overflow = TextOverflow .Ellipsis
640
642
)
641
- Spacer (modifier = Modifier .height(32 .dp))
642
- Text (
643
+ HtmlText (
643
644
text = summary,
644
645
style = MaterialTheme .typography.bodyMedium,
646
+ color = LocalContentColor .current
645
647
)
646
- Spacer (modifier = Modifier .weight(1f ))
647
648
}
648
649
}
649
650
@@ -776,6 +777,25 @@ private fun FullScreenLoading(modifier: Modifier = Modifier) {
776
777
}
777
778
}
778
779
780
+ @Composable
781
+ private fun HtmlText (
782
+ text : String ,
783
+ style : TextStyle ,
784
+ color : Color
785
+ ) {
786
+ val annotationString = buildAnnotatedString {
787
+ val htmlCompat = HtmlCompat .fromHtml(text, HtmlCompat .FROM_HTML_MODE_COMPACT )
788
+ append(htmlCompat)
789
+ }
790
+ SelectionContainer {
791
+ Text (
792
+ text = annotationString,
793
+ style = style,
794
+ color = color
795
+ )
796
+ }
797
+ }
798
+
779
799
@Preview
780
800
@Composable
781
801
fun TopAppBarPreview () {
0 commit comments