"Check mark" fix on cover

if the manga has been read in full, the "check mark" will be displayed correctly on the cover
This commit is contained in:
Mac135135
2025-02-18 00:46:03 +03:00
parent b44cf370aa
commit 9bb97c72a1
2 changed files with 11 additions and 4 deletions

View File

@@ -145,10 +145,11 @@ class HistoryRepository @Inject constructor(
suspend fun getProgress(mangaId: Long, mode: ProgressIndicatorMode): ReadingProgress? {
val entity = db.getHistoryDao().find(mangaId) ?: return null
val fixedPercent = if (entity.percent >= 0.999999f) 1f else entity.percent
return ReadingProgress(
percent = entity.percent,
percent = fixedPercent,
totalChapters = entity.chaptersCount,
mode = mode,
mode = mode
).takeIf { it.isValid() }
}

View File

@@ -473,9 +473,15 @@ class ReaderViewModel @Inject constructor(
if (chaptersCount == 0 || pagesCount == 0) {
return PROGRESS_NONE
}
val pagePercent = (pageIndex + 1) / pagesCount.toFloat()
val pagePercent = (pageIndex + 1).toFloat() / pagesCount
val ppc = 1f / chaptersCount
return ppc * chapterIndex + ppc * pagePercent
var progress = ppc * chapterIndex + ppc * pagePercent
if (chapterIndex == chaptersCount - 1 && pageIndex + 1 == pagesCount) {
progress = 1.0f
}
return progress
}
private fun observeIsWebtoonZoomEnabled() = settings.observeAsFlow(