mirror of
https://github.com/TeamNewPipe/NewPipe.git
synced 2024-11-25 12:32:31 +01:00
Make parsed links clickable, visible
This commit is contained in:
parent
e639b02fed
commit
4740e3be86
@ -290,7 +290,7 @@ dependencies {
|
|||||||
|
|
||||||
// Jetpack Compose
|
// Jetpack Compose
|
||||||
implementation(platform('androidx.compose:compose-bom:2024.06.00'))
|
implementation(platform('androidx.compose:compose-bom:2024.06.00'))
|
||||||
implementation 'androidx.compose.material3:material3'
|
implementation 'androidx.compose.material3:material3:1.3.0-beta04'
|
||||||
implementation 'androidx.activity:activity-compose'
|
implementation 'androidx.activity:activity-compose'
|
||||||
implementation 'androidx.compose.ui:ui-tooling-preview'
|
implementation 'androidx.compose.ui:ui-tooling-preview'
|
||||||
implementation 'androidx.compose.ui:ui-text:1.7.0-beta04' // Needed for parsing HTML to AnnotatedString
|
implementation 'androidx.compose.ui:ui-text:1.7.0-beta04' // Needed for parsing HTML to AnnotatedString
|
||||||
|
@ -4,7 +4,10 @@ import androidx.compose.runtime.Composable
|
|||||||
import androidx.compose.runtime.remember
|
import androidx.compose.runtime.remember
|
||||||
import androidx.compose.ui.text.AnnotatedString
|
import androidx.compose.ui.text.AnnotatedString
|
||||||
import androidx.compose.ui.text.ParagraphStyle
|
import androidx.compose.ui.text.ParagraphStyle
|
||||||
|
import androidx.compose.ui.text.SpanStyle
|
||||||
|
import androidx.compose.ui.text.TextLinkStyles
|
||||||
import androidx.compose.ui.text.fromHtml
|
import androidx.compose.ui.text.fromHtml
|
||||||
|
import androidx.compose.ui.text.style.TextDecoration
|
||||||
import org.schabi.newpipe.extractor.stream.Description
|
import org.schabi.newpipe.extractor.stream.Description
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
@ -12,7 +15,8 @@ fun rememberParsedDescription(description: Description): AnnotatedString {
|
|||||||
// TODO: Handle links and hashtags, Markdown.
|
// TODO: Handle links and hashtags, Markdown.
|
||||||
return remember(description) {
|
return remember(description) {
|
||||||
if (description.type == Description.HTML) {
|
if (description.type == Description.HTML) {
|
||||||
AnnotatedString.fromHtml(description.content)
|
val styles = TextLinkStyles(SpanStyle(textDecoration = TextDecoration.Underline))
|
||||||
|
AnnotatedString.fromHtml(description.content, styles)
|
||||||
} else {
|
} else {
|
||||||
AnnotatedString(description.content, ParagraphStyle())
|
AnnotatedString(description.content, ParagraphStyle())
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user