v1.0.45-oss (#221)

* Implemented ML-based comic panel detection and a panel popup viewer.

* Optimized `ComicPanelDetector` for performance and memory efficiency.

* Optimized comic panel detection performance by introducing a dedicated single-thread dispatcher for ML tasks, replacing mutex-based synchronization.

* Refactored system UI handling and layout padding in `PdfViewerScreen`.

* Refactor `PdfViewerScreen.kt` by extracting components and logic into specialized files.

* replace hardcoded padding with dynamic header height and adjust IME layout logic

* Improve `PdfTextBox` interaction and visual consistency during zoom and pan.

* improve PDF text box dragging and scaling behavior across zoom levels

* optimize color scheme calculation using remember and expand text dimming coverage

* Implement in-app language selection and per-app language preferences.

* Improve PDF lock stability in `PdfVerticalReader`

* Implement "Preserve Image Colors" option for PDF themes

* Optimize TOC locate in ReaderDrawer

* Update library and home screen UI components

* smoother page turn animation in epub pagination mode

* Implement automatic page skipping for TTS when no text is found in PDF viewer

* Refine status bar handling and window insets across main screens

* Optimize ViewModel initialization and integrate AndroidX SplashScreen

* Move ComicPanelDetector to debug source set and introduce IPanelDetector interface

* Optimize TOC scrolling in PdfNavigationDrawerContent

* Bump version to 1.0.45(45)
This commit is contained in:
Aryan 2026-04-22 14:11:52 +05:30 committed by GitHub
parent 71e3614ad6
commit cb7de86224
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
33 changed files with 4795 additions and 3447 deletions

View file

@ -94,6 +94,7 @@ import com.aryan.reader.R
import com.aryan.reader.RenderMode
import com.aryan.reader.epub.EpubChapter
import com.aryan.reader.epub.EpubTocEntry
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import timber.log.Timber
@ -329,29 +330,31 @@ private fun ChaptersList(
mutableStateOf(allParentIndices)
}
val visibleItemInfo = remember(effectiveToc, expandedEntryIndices) {
val result = mutableListOf<Pair<Int, EpubTocEntry>>()
val visibilityStack = BooleanArray(50) { false }
visibilityStack[0] = true
val visibleItemInfo by remember(effectiveToc) {
derivedStateOf {
val result = mutableListOf<Pair<Int, EpubTocEntry>>()
val visibilityStack = BooleanArray(50) { false }
visibilityStack[0] = true
for (i in effectiveToc.indices) {
val entry = effectiveToc[i]
val depth = entry.depth.coerceIn(0, 49)
for (i in effectiveToc.indices) {
val entry = effectiveToc[i]
val depth = entry.depth.coerceIn(0, 49)
if (visibilityStack[depth]) {
result.add(i to entry)
if (visibilityStack[depth]) {
result.add(i to entry)
val isExpanded = expandedEntryIndices.contains(i)
if (depth + 1 < visibilityStack.size) {
visibilityStack[depth + 1] = isExpanded
}
} else {
if (depth + 1 < visibilityStack.size) {
visibilityStack[depth + 1] = false
val isExpanded = expandedEntryIndices.contains(i)
if (depth + 1 < visibilityStack.size) {
visibilityStack[depth + 1] = isExpanded
}
} else {
if (depth + 1 < visibilityStack.size) {
visibilityStack[depth + 1] = false
}
}
}
result
}
result
}
val coroutineScope = rememberCoroutineScope()
@ -367,23 +370,29 @@ private fun ChaptersList(
val targetEntry = activeTocEntry ?: return@launch
val targetOriginalIndex = effectiveToc.indexOf(targetEntry)
if (targetOriginalIndex != -1) {
// Ensure parents are expanded
var currentLevel = targetEntry.depth
val newExpanded = expandedEntryIndices.toMutableSet()
for (i in targetOriginalIndex downTo 0) {
val entry = effectiveToc[i]
if (entry.depth < currentLevel) {
newExpanded.add(i)
currentLevel = entry.depth
}
if (currentLevel == 0) break
}
expandedEntryIndices = newExpanded
// Delay to allow visibility array to recompose
kotlinx.coroutines.delay(100)
val visibleIdx = visibleItemInfo.indexOfFirst { it.second == targetEntry }
if (visibleIdx != -1) {
var attempts = 0
while (listState.layoutInfo.totalItemsCount <= visibleIdx && attempts < 10) {
delay(30)
attempts++
}
listState.animateScrollToItem(visibleIdx)
}
}