@@ -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,
|
||||||
|
|||||||
@@ -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() }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user