[添加判空逻辑]
This commit is contained in:
yangyakun
2024-08-21 16:56:22 +08:00
parent 787e4835ef
commit 259d8a5305
2 changed files with 12 additions and 4 deletions

View File

@@ -110,7 +110,9 @@ object DownloadManager {
}
// 改名后文件存在 不需要下载
if(isLocalCacheFileExists(first.downloadUrl)){
waitDownLoadList.removeFirst()
if(waitDownLoadList.size>0) {
waitDownLoadList.removeFirst()
}
OchChainLogManager.writechainLogDownload("取消下载文件已存在","信息:${first}")
go2Download()
return
@@ -134,7 +136,9 @@ object DownloadManager {
override fun onFinished(url: String, path: String) {
OchChainLogManager.writechainLogDownload("下载成功","url:${url}---path:${path}")
waitDownLoadList.removeFirst()
if(waitDownLoadList.size>0) {
waitDownLoadList.removeFirst()
}
if(path.endsWith("_temp")){
val tempFile = File(path)
val newName = tempFile.name.replace("_temp","")
@@ -150,7 +154,9 @@ object DownloadManager {
clearLocalFile(first.downloadDir+File.separator+first.downloadFileName)
if(first.downLoadCount>=5){
OchChainLogManager.writechainLogDownload("下载错误5次可终点关注","url:${url}---error:${error}")
waitDownLoadList.removeFirst()
if(waitDownLoadList.size>0) {
waitDownLoadList.removeFirst()
}
go2Download()
return
}

View File

@@ -245,7 +245,9 @@ class AdvancePagerAdapter(context: Context, viewPager: ViewPager) : PagerAdapter
itemView.initVideoUrlData(currentMediaItem.fileUrl,currentMediaItem.coverImageUrl,currentMediaItem.priority)
itemView.setThumbImageViewVisible()
itemView.startPlayVideo(hightPriorityVideoPlayLifecycleCallBack)
hightPriorityMediaItem.removeFirst()
if(hightPriorityMediaItem.size>0) {
hightPriorityMediaItem.removeFirst()
}
}
// 当前正在播放图片
is AdvanceImageView -> {