Lottie动画资源放到服务器预下载,2024最新版

avatar
作者
猴君
阅读量:1

return
}
//资源打包成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 + it).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}/ FileDownloa

广告一刻

为您即时展示最新活动产品广告消息,让您随时掌握产品活动新动态!