mirror of
				https://github.com/TeamNewPipe/NewPipe
				synced 2025-10-31 15:23:00 +00:00 
			
		
		
		
	Make parsed links clickable, visible
This commit is contained in:
		| @@ -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()) | ||||||
|         } |         } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Isira Seneviratne
					Isira Seneviratne