Text lookup upgrade (#66)

* Added `TooltipIconButton` and integrated tooltips for tool icons in app bars

* Added external translate and search support for EPUB and PDF readers

* docs: refine project overview and update build instructions in readme
This commit is contained in:
Aryan 2026-03-14 13:01:46 +05:30 committed by GitHub
parent 74e2cec415
commit f2c5ae25d7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 1172 additions and 506 deletions

View file

@ -389,6 +389,8 @@ internal fun PdfPageComposable(
isProUser: Boolean,
onShowDictionaryUpsellDialog: () -> Unit,
onWordSelectedForAiDefinition: (String) -> Unit,
onTranslateText: (String) -> Unit,
onSearchText: (String) -> Unit,
ttsHighlightData: TtsHighlightData?,
onLinkClicked: (String) -> Unit,
onInternalLinkClicked: (Int) -> Unit,
@ -3685,6 +3687,36 @@ internal fun PdfPageComposable(
)
}
},
onTranslate = { textToTranslate ->
onTranslateText(textToTranslate.trim())
customMenuState = null
selectionCharRange.value = null
coroutineScope.launch {
updateSelectionVisuals(
pdfDocumentItem,
pdfPageIndex,
null,
actualBitmapWidthPx,
actualBitmapHeightPx,
currentPageRotation
)
}
},
onSearch = { textToSearch ->
onSearchText(textToSearch.trim())
customMenuState = null
selectionCharRange.value = null
coroutineScope.launch {
updateSelectionVisuals(
pdfDocumentItem,
pdfPageIndex,
null,
actualBitmapWidthPx,
actualBitmapHeightPx,
currentPageRotation
)
}
},
onSelectAll = {
customMenuState = null
coroutineScope.launch {
@ -4523,6 +4555,8 @@ private fun PdfPageRenderer(
onMenuDismiss: () -> Unit,
onCopy: (String) -> Unit,
onAiDefine: (String) -> Unit,
onTranslate: (String) -> Unit,
onSearch: (String) -> Unit,
onSelectAll: () -> Unit,
onShowUpsellDialog: () -> Unit,
isProUser: Boolean,
@ -4934,6 +4968,8 @@ private fun PdfPageRenderer(
onDismiss = onMenuDismiss,
onCopy = onCopy,
onAiDefine = onAiDefine,
onTranslate = onTranslate,
onSearch = onSearch,
onSelectAll = onSelectAll,
onColorSelected = { color ->
Timber.tag("PdfHighlightDebug").d("PdfSelectionMenuPopup onColorSelected: $color, isExisting=${menuState.isExistingHighlight}")