//资源打包成zip文件放到了服务器上,所以下载下来要解压缩
LottieAnimationUtils.unZip(download.file, parentPath)
downloadCount(true)
}
override fun onError(download: Download, error: Error, throwable: Throwable?) {
if (download.group != groupId) {
return
}
downloadCount(false)
}
private val downloadCount: (Boolean) -> Unit = {
downloaded++
if (downloaded == num) {
callback?.invoke(it)
fetch.removeListener(this)
}
}
}
fun downloadList(pathList: List, priority: Priority = Priority.NORMAL, callback: ((Boolean) -> Unit)? = null) {
val groupId = Random.nextInt()
pathList.filter {
//本地文件不存在的才下载
!File(parentPath + File.separator + i
《Android学习笔记总结+最新移动架构视频+大厂安卓面试真题+项目实战源码讲义》
【docs.qq.com/doc/DSkNLaERkbnFoS0ZF】 完整内容开源分享
t).exists()
}.flatMap { path ->
arrayListOf(Request(“ F i l e D o w n l o a d C o n s t a n t . B a s e C o n f i g . G I F T P A T H / {FileDownloadConstant.BaseConfig.GIFT_PATH}/ FileDo