Fix progress percent computatiion #327

This commit is contained in:
Koitharu
2023-03-21 20:03:57 +02:00
parent 527e11e65b
commit b45147563a
4 changed files with 42 additions and 18 deletions

View File

@@ -381,7 +381,8 @@ class ReaderViewModel @Inject constructor(
}
private fun computePercent(chapterId: Long, pageIndex: Int): Float {
val chapters = manga?.chapters ?: return PROGRESS_NONE
val branch = chapters[chapterId]?.branch
val chapters = manga?.getChapters(branch) ?: return PROGRESS_NONE
val chaptersCount = chapters.size
val chapterIndex = chapters.indexOfFirst { x -> x.id == chapterId }
val pagesCount = chaptersLoader.getPagesCount(chapterId)