Merge pull request #1295 from MAPKOBKA135/devel

fix 100% problem
This commit is contained in:
Koitharu
2025-02-18 15:29:09 +02:00
committed by GitHub
2 changed files with 6 additions and 3 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

@@ -154,10 +154,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() }
} }