diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/DetailsActivity.kt b/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/DetailsActivity.kt index 4c774bd0a..1925d1ca8 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/DetailsActivity.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/DetailsActivity.kt @@ -484,8 +484,10 @@ class DetailsActivity : textViewProgress.textAndVisible = if (info.percent <= 0f) { null } 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.max * info.percent.coerceIn(0f, 1f)).roundToInt(), true, diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/history/data/HistoryRepository.kt b/app/src/main/kotlin/org/koitharu/kotatsu/history/data/HistoryRepository.kt index 01fcf35b5..060211ddc 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/history/data/HistoryRepository.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/history/data/HistoryRepository.kt @@ -154,10 +154,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() } }