CustomSelectionContainer: toolbarShown → toolbarHidden(typo correction) + ReaderTextParagraph: No OnClick and OnDoubleClick actions when text is selecting. (v1.0.1)

This commit is contained in:
acclorite 2024-06-05 13:53:30 +03:00
parent 04e67aa03c
commit 9dfa06973f
3 changed files with 8 additions and 4 deletions

View file

@ -207,7 +207,7 @@ fun CustomSelectionContainer(
onCopyRequested: (() -> Unit),
onTranslateRequested: ((String) -> Unit),
onDictionaryRequested: ((String) -> Unit),
content: @Composable (Boolean) -> Unit
content: @Composable (toolbarHidden: Boolean) -> Unit
) {
val view = LocalView.current
val context = LocalContext.current

View file

@ -348,14 +348,14 @@ private fun ReaderScreen(
)
)
}
) { toolbarShowed ->
) { toolbarHidden ->
LazyColumn(
state = state.value.listState,
modifier = Modifier
.fillMaxSize()
.background(backgroundColor)
.then(
if (!loading.value && toolbarShowed) {
if (!loading.value && toolbarHidden) {
Modifier
.clickable(
interactionSource = null,
@ -398,6 +398,7 @@ private fun ReaderScreen(
fontSize = mainState.value.fontSize!!.sp,
sidePadding = sidePadding,
paragraphIndentation = mainState.value.paragraphIndentation!!,
toolbarHidden = toolbarHidden,
onEvent = onEvent
)
}

View file

@ -60,6 +60,7 @@ import java.util.Locale
* @param fontSize Line's font size.
* @param sidePadding Line's side padding.
* @param paragraphIndentation Whether Paragraph Indentation is enabled for this line.
* @param toolbarHidden Whether selection toolbar is hidden.
* @param onEvent [ReaderEvent] callback.
*/
@OptIn(ExperimentalFoundationApi::class)
@ -77,6 +78,7 @@ fun LazyItemScope.ReaderTextParagraph(
fontSize: TextUnit,
sidePadding: Dp,
paragraphIndentation: Boolean,
toolbarHidden: Boolean,
onEvent: (ReaderEvent) -> Unit
) {
val text = remember(
@ -167,7 +169,8 @@ fun LazyItemScope.ReaderTextParagraph(
.then(
if (
state.value.book.enableTranslator &&
state.value.book.doubleClickTranslation
state.value.book.doubleClickTranslation &&
toolbarHidden
) {
Modifier.combinedClickable(
interactionSource = null,