"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:
@@ -145,10 +145,11 @@ class HistoryRepository @Inject constructor(
|
|||||||
|
|
||||||
suspend fun getProgress(mangaId: Long, mode: ProgressIndicatorMode): ReadingProgress? {
|
suspend fun getProgress(mangaId: Long, mode: ProgressIndicatorMode): ReadingProgress? {
|
||||||
val entity = db.getHistoryDao().find(mangaId) ?: return null
|
val entity = db.getHistoryDao().find(mangaId) ?: return null
|
||||||
|
val fixedPercent = if (entity.percent >= 0.999999f) 1f else entity.percent
|
||||||
return ReadingProgress(
|
return ReadingProgress(
|
||||||
percent = entity.percent,
|
percent = fixedPercent,
|
||||||
totalChapters = entity.chaptersCount,
|
totalChapters = entity.chaptersCount,
|
||||||
mode = mode,
|
mode = mode
|
||||||
).takeIf { it.isValid() }
|
).takeIf { it.isValid() }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -473,9 +473,15 @@ class ReaderViewModel @Inject constructor(
|
|||||||
if (chaptersCount == 0 || pagesCount == 0) {
|
if (chaptersCount == 0 || pagesCount == 0) {
|
||||||
return PROGRESS_NONE
|
return PROGRESS_NONE
|
||||||
}
|
}
|
||||||
val pagePercent = (pageIndex + 1) / pagesCount.toFloat()
|
val pagePercent = (pageIndex + 1).toFloat() / pagesCount
|
||||||
val ppc = 1f / chaptersCount
|
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(
|
private fun observeIsWebtoonZoomEnabled() = settings.observeAsFlow(
|
||||||
|
|||||||
Reference in New Issue
Block a user