correct display of a fully read manga

shows 100% in the details menu if the manga has actually been read in full.
This commit is contained in:
Mac135135
2025-02-18 01:24:48 +03:00
parent 9bb97c72a1
commit 52592ba765
2 changed files with 5 additions and 9 deletions

View File

@@ -484,8 +484,10 @@ class DetailsActivity :
textViewProgress.textAndVisible = if (info.percent <= 0f) { textViewProgress.textAndVisible = if (info.percent <= 0f) {
null null
} else { } else {
getString(R.string.percent_string_pattern, (info.percent * 100f).toInt().toString()) val displayPercent = if (info.percent >= 0.999999f) 100 else (info.percent * 100f).toInt()
getString(R.string.percent_string_pattern, displayPercent.toString())
} }
progress.setProgressCompat( progress.setProgressCompat(
(progress.max * info.percent.coerceIn(0f, 1f)).roundToInt(), (progress.max * info.percent.coerceIn(0f, 1f)).roundToInt(),
true, true,

View File

@@ -473,15 +473,9 @@ class ReaderViewModel @Inject constructor(
if (chaptersCount == 0 || pagesCount == 0) { if (chaptersCount == 0 || pagesCount == 0) {
return PROGRESS_NONE return PROGRESS_NONE
} }
val pagePercent = (pageIndex + 1).toFloat() / pagesCount val pagePercent = (pageIndex + 1) / pagesCount.toFloat()
val ppc = 1f / chaptersCount val ppc = 1f / chaptersCount
var progress = ppc * chapterIndex + ppc * pagePercent return 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(