diff --git a/app/src/main/java/com/lagradost/quicknovel/ReadActivityViewModel.kt b/app/src/main/java/com/lagradost/quicknovel/ReadActivityViewModel.kt index 558fc7e9..94d776a9 100644 --- a/app/src/main/java/com/lagradost/quicknovel/ReadActivityViewModel.kt +++ b/app/src/main/java/com/lagradost/quicknovel/ReadActivityViewModel.kt @@ -62,6 +62,7 @@ import kotlinx.coroutines.runBlocking import kotlinx.coroutines.sync.Mutex import kotlinx.coroutines.sync.withLock import nl.siegmann.epublib.domain.Book +import nl.siegmann.epublib.domain.TOCReference import nl.siegmann.epublib.epub.EpubReader import org.commonmark.node.Node import org.jsoup.Jsoup @@ -238,6 +239,17 @@ class QuickBook(val data: QuickStreamData) : AbstractBook() { } class RegularBook(val data: Book) : AbstractBook() { + init { + var refs = mutableListOf() + data.tableOfContents.tocReferences.forEach { ref -> + refs.add(ref) + if (ref.children != null) { + refs.addAll(ref.children) + } + } + data.tableOfContents.tocReferences = refs + } + override val canReload = false override fun size(): Int { @@ -1242,4 +1254,4 @@ class ReadActivityViewModel : ViewModel() { var screenAwake by PreferenceDelegateLiveView( EPUB_KEEP_SCREEN_ACTIVE, true, Boolean::class, screenAwakeLive ) -} \ No newline at end of file +}