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), onCopyRequested: (() -> Unit),
onTranslateRequested: ((String) -> Unit), onTranslateRequested: ((String) -> Unit),
onDictionaryRequested: ((String) -> Unit), onDictionaryRequested: ((String) -> Unit),
content: @Composable (Boolean) -> Unit content: @Composable (toolbarHidden: Boolean) -> Unit
) { ) {
val view = LocalView.current val view = LocalView.current
val context = LocalContext.current val context = LocalContext.current

View file

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

View file

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