Skip to content

Commit

Permalink
add enable parameter to SelectionContainer
Browse files Browse the repository at this point in the history
  • Loading branch information
seiko committed Dec 31, 2021
1 parent cb3282c commit 28cbbb7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,13 @@ class PositionWrapper {
@Composable
fun SelectionContainer(
modifier: Modifier = Modifier,
enable: Boolean = true,
content: @Composable (PositionWrapper?) -> Unit,
) {
if (!enable) {
content.invoke(null)
return
}
val positionWrapper = remember {
if (currentPlatform != Platform.Android) PositionWrapper() else null
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,27 +86,15 @@ fun ColumnScope.StatusText(
}
AnimatedVisibility(visible = expanded) {
Column {
if (isSelectionAble) {
SelectionContainer {
HtmlText(
modifier = Modifier.fillMaxWidth(),
htmlText = status.htmlText,
maxLines = maxLines,
linkResolver = { href ->
status.resolveLink(href)
},
positionWrapper = it
)
}
} else {
SelectionContainer(enable = isSelectionAble) {
HtmlText(
modifier = Modifier.fillMaxWidth(),
htmlText = status.htmlText,
maxLines = maxLines,
linkResolver = { href ->
status.resolveLink(href)
},
positionWrapper = null
positionWrapper = it
)
}
if (showMastodonPoll && status.platformType == PlatformType.Mastodon && status.poll != null) {
Expand Down

0 comments on commit 28cbbb7

Please sign in to comment.