2020-09-06 10:33:04 +00:00
|
|
|
package com.vanced.manager.model
|
|
|
|
|
2020-11-15 14:53:25 +00:00
|
|
|
import androidx.lifecycle.MutableLiveData
|
2020-11-23 16:00:41 +00:00
|
|
|
import com.github.kittinunf.fuel.core.requests.CancellableRequest
|
2020-09-17 10:13:16 +00:00
|
|
|
|
2020-09-06 10:33:04 +00:00
|
|
|
open class ProgressModel {
|
2020-11-15 14:53:25 +00:00
|
|
|
|
|
|
|
val downloadProgress = MutableLiveData<Int>()
|
|
|
|
val downloadingFile = MutableLiveData<String>()
|
|
|
|
val installing = MutableLiveData<Boolean>()
|
2020-09-17 10:13:16 +00:00
|
|
|
|
2020-11-23 16:00:41 +00:00
|
|
|
var currentDownload: CancellableRequest? = null
|
2020-09-25 13:14:38 +00:00
|
|
|
|
2020-10-31 19:45:39 +00:00
|
|
|
fun reset() {
|
2020-11-15 14:53:25 +00:00
|
|
|
downloadProgress.value = 0
|
|
|
|
downloadingFile.value = ""
|
2020-10-31 19:45:39 +00:00
|
|
|
}
|
|
|
|
|
2020-11-23 16:00:41 +00:00
|
|
|
fun postReset() {
|
|
|
|
downloadProgress.postValue(0)
|
|
|
|
downloadingFile.postValue("")
|
|
|
|
}
|
|
|
|
|
2020-10-31 19:45:39 +00:00
|
|
|
init {
|
2020-11-15 14:53:25 +00:00
|
|
|
installing.value = false
|
2020-10-31 19:45:39 +00:00
|
|
|
reset()
|
2020-09-06 10:33:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|