mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-14 05:05:06 +01:00
Using a float on the progress on app updates
Not sure if needed but I saw some funny behavior with the progress bar
This commit is contained in:
parent
81efada033
commit
4b50692cee
@ -21,9 +21,9 @@ import eu.kanade.tachiyomi.util.system.isServiceRunning
|
|||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.GlobalScope
|
import kotlinx.coroutines.GlobalScope
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import java.io.File
|
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
import uy.kohesive.injekt.injectLazy
|
import uy.kohesive.injekt.injectLazy
|
||||||
|
import java.io.File
|
||||||
|
|
||||||
class UpdaterService : Service() {
|
class UpdaterService : Service() {
|
||||||
|
|
||||||
@ -100,7 +100,7 @@ class UpdaterService : Service() {
|
|||||||
var lastTick = 0L
|
var lastTick = 0L
|
||||||
|
|
||||||
override fun update(bytesRead: Long, contentLength: Long, done: Boolean) {
|
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()
|
val currentTime = System.currentTimeMillis()
|
||||||
if (progress > savedProgress && currentTime - 200 > lastTick) {
|
if (progress > savedProgress && currentTime - 200 > lastTick) {
|
||||||
savedProgress = progress
|
savedProgress = progress
|
||||||
|
Loading…
Reference in New Issue
Block a user