From 11b62e510108c5f5d45cb85bd727d133e9f58cec Mon Sep 17 00:00:00 2001 From: machiav3lli Date: Wed, 3 Aug 2022 02:43:47 +0200 Subject: [PATCH] Update: Make Block text selectable --- .../pages/app_detail/components/TextBlock.kt | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/main/kotlin/com/machiav3lli/fdroid/ui/compose/pages/app_detail/components/TextBlock.kt b/src/main/kotlin/com/machiav3lli/fdroid/ui/compose/pages/app_detail/components/TextBlock.kt index 2cd1255f..6c2ffd79 100644 --- a/src/main/kotlin/com/machiav3lli/fdroid/ui/compose/pages/app_detail/components/TextBlock.kt +++ b/src/main/kotlin/com/machiav3lli/fdroid/ui/compose/pages/app_detail/components/TextBlock.kt @@ -6,6 +6,7 @@ import androidx.compose.animation.core.tween import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.text.selection.SelectionContainer import androidx.compose.material3.FilledTonalButton import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Surface @@ -48,16 +49,18 @@ fun HtmlTextBlock( targetValue = if (isExpanded) Int.MAX_VALUE else 12, animationSpec = tween(durationMillis = 200) ) - HtmlText( - modifier = Modifier - .fillMaxWidth() - .padding(16.dp) - .animateContentSize(), - text = description, - color = MaterialTheme.colorScheme.onBackground, - maxLines = maxLines, - overflow = TextOverflow.Ellipsis - ) + SelectionContainer { + HtmlText( + modifier = Modifier + .fillMaxWidth() + .padding(16.dp) + .animateContentSize(), + text = description, + color = MaterialTheme.colorScheme.onBackground, + maxLines = maxLines, + overflow = TextOverflow.Ellipsis + ) + } } if (description.length >= 290 && isExpandable) { FilledTonalButton(onClick = { isExpanded = !isExpanded }) {