From 60bcebe4d17730e5abb0a409a06af2d6853c61ad Mon Sep 17 00:00:00 2001 From: arkon Date: Sat, 8 Oct 2022 12:57:00 -0400 Subject: [PATCH] Allow manual selection of manga description instead of copying to clipboard Closes #6548 Notably missing some "standard" options like "Select all" or "Share": https://issuetracker.google.com/issues/226648919 --- .../manga/components/MangaInfoHeader.kt | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/app/src/main/java/eu/kanade/presentation/manga/components/MangaInfoHeader.kt b/app/src/main/java/eu/kanade/presentation/manga/components/MangaInfoHeader.kt index ce259acfb..1c90273bf 100644 --- a/app/src/main/java/eu/kanade/presentation/manga/components/MangaInfoHeader.kt +++ b/app/src/main/java/eu/kanade/presentation/manga/components/MangaInfoHeader.kt @@ -21,6 +21,7 @@ import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.sizeIn import androidx.compose.foundation.lazy.LazyRow import androidx.compose.foundation.lazy.items +import androidx.compose.foundation.text.selection.SelectionContainer import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.AttachMoney import androidx.compose.material.icons.filled.Block @@ -209,7 +210,6 @@ fun ExpandableMangaDescription( tagsProvider: () -> List?, onTagClicked: (String) -> Unit, ) { - val context = LocalContext.current Column(modifier = modifier) { val (expanded, onExpanded) = rememberSaveable { mutableStateOf(defaultExpandState) @@ -228,10 +228,7 @@ fun ExpandableMangaDescription( modifier = Modifier .padding(top = 8.dp) .padding(horizontal = 16.dp) - .clickableNoIndication( - onLongClick = { context.copyToClipboard(desc, desc) }, - onClick = { onExpanded(!expanded) }, - ), + .clickableNoIndication { onExpanded(!expanded) }, ) val tags = tagsProvider() if (!tags.isNullOrEmpty()) { @@ -566,13 +563,15 @@ private fun MangaSummary( expandedHeight = expandedPlaceable.maxByOrNull { it.height }?.height?.coerceAtLeast(shrunkHeight) ?: 0 val actualPlaceable = subcompose("description") { - Text( - text = if (expanded) expandedDescription else shrunkDescription, - maxLines = Int.MAX_VALUE, - style = MaterialTheme.typography.bodyMedium, - color = MaterialTheme.colorScheme.onBackground, - modifier = Modifier.secondaryItemAlpha(), - ) + SelectionContainer { + Text( + text = if (expanded) expandedDescription else shrunkDescription, + maxLines = Int.MAX_VALUE, + style = MaterialTheme.typography.bodyMedium, + color = MaterialTheme.colorScheme.onBackground, + modifier = Modifier.secondaryItemAlpha(), + ) + } }.map { it.measure(constraints) } val scrimPlaceable = subcompose("scrim") {