From 4b50692cee35966857f277d820cb698be088de24 Mon Sep 17 00:00:00 2001 From: Jay Date: Sun, 10 May 2020 18:04:03 -0400 Subject: [PATCH] Using a float on the progress on app updates Not sure if needed but I saw some funny behavior with the progress bar --- .../java/eu/kanade/tachiyomi/data/updater/UpdaterService.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/updater/UpdaterService.kt b/app/src/main/java/eu/kanade/tachiyomi/data/updater/UpdaterService.kt index d6c4bc9b1b..5ce2c45558 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/updater/UpdaterService.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/updater/UpdaterService.kt @@ -21,9 +21,9 @@ import eu.kanade.tachiyomi.util.system.isServiceRunning import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.launch -import java.io.File import timber.log.Timber import uy.kohesive.injekt.injectLazy +import java.io.File class UpdaterService : Service() { @@ -100,7 +100,7 @@ class UpdaterService : Service() { var lastTick = 0L override fun update(bytesRead: Long, contentLength: Long, done: Boolean) { - val progress = (100 * bytesRead / contentLength).toInt() + val progress = (100 * (bytesRead.toFloat() / contentLength)).toInt() val currentTime = System.currentTimeMillis() if (progress > savedProgress && currentTime - 200 > lastTick) { savedProgress = progress