This commit is contained in:
ocean 2024-06-27 17:58:40 +08:00
parent 4785b50894
commit e767cbd980
3 changed files with 23 additions and 3 deletions

View File

@ -192,11 +192,13 @@ class MoLikedSongsActivity : MoBaseActivity(), LikedSongsAdapter.OnItemFavorites
binding.downloadImg.setImageResource(R.drawable.more_downloaded_icon) binding.downloadImg.setImageResource(R.drawable.more_downloaded_icon)
binding.downloadTv.text = binding.downloadTv.text =
getString(R.string.download_remove_offline) getString(R.string.download_remove_offline)
LogTag.LogD(TAG,"like OnUpdateDownloadUi 1111")
} else { } else {
binding.downloadLoading.visibility = View.GONE binding.downloadLoading.visibility = View.GONE
binding.downloadImg.visibility = View.VISIBLE binding.downloadImg.visibility = View.VISIBLE
binding.downloadImg.setImageResource(R.drawable.more_download_icon) binding.downloadImg.setImageResource(R.drawable.more_download_icon)
binding.downloadTv.text = getString(R.string.download_save_offline) binding.downloadTv.text = getString(R.string.download_save_offline)
LogTag.LogD(TAG,"like OnUpdateDownloadUi 2222")
} }
} }
@ -321,6 +323,7 @@ class MoLikedSongsActivity : MoBaseActivity(), LikedSongsAdapter.OnItemFavorites
} }
private fun updateDownloadUI(download: Download) { private fun updateDownloadUI(download: Download) {
LogTag.LogD(TAG,"like updateDownloadUI download-${download.state}")
when (download.state) { when (download.state) {
Download.STATE_DOWNLOADING -> { Download.STATE_DOWNLOADING -> {
binding.downloadLoading.visibility = View.VISIBLE binding.downloadLoading.visibility = View.VISIBLE
@ -413,7 +416,14 @@ class MoLikedSongsActivity : MoBaseActivity(), LikedSongsAdapter.OnItemFavorites
val currentDownload = DownloadUtil.getCurrentIdDownload(bean.videoId) val currentDownload = DownloadUtil.getCurrentIdDownload(bean.videoId)
if (currentDownload != null) { if (currentDownload != null) {
updateDownloadUI(currentDownload) //是否下载过资源下载过资源就不走download的ui更新因为 它肯定状态为3
if(DownloadUtil.downloadResourceExist(bean.videoId)){
requests.trySend(Request.OnUpdateDownloadUi(bean.videoId))
}else{
updateDownloadUI(currentDownload)
}
} else {
requests.trySend(Request.OnUpdateDownloadUi(bean.videoId))
} }
} }

View File

@ -532,7 +532,12 @@ class MoListDetailsActivity : MoBaseActivity(), DetailsListAdapter.OnItemMoreCli
val currentDownload = DownloadUtil.getCurrentIdDownload(bean.videoId!!) val currentDownload = DownloadUtil.getCurrentIdDownload(bean.videoId!!)
if (currentDownload != null) { if (currentDownload != null) {
updateDownloadUI(currentDownload) //是否下载过资源下载过资源就不走download的ui更新因为 它肯定状态为3
if(DownloadUtil.downloadResourceExist(bean.videoId)){
requests.trySend(Request.OnUpdateDownloadUi(bean.videoId))
}else{
updateDownloadUI(currentDownload)
}
} else { } else {
requests.trySend(Request.OnUpdateDownloadUi(bean.videoId)) requests.trySend(Request.OnUpdateDownloadUi(bean.videoId))
} }

View File

@ -495,7 +495,12 @@ class MoPlaylistSongsActivity : MoBaseActivity() {
val currentDownload = DownloadUtil.getCurrentIdDownload(bean.videoId) val currentDownload = DownloadUtil.getCurrentIdDownload(bean.videoId)
if (currentDownload != null) { if (currentDownload != null) {
updateDownloadUI(currentDownload) //是否下载过资源下载过资源就不走download的ui更新因为 它肯定状态为3
if(DownloadUtil.downloadResourceExist(bean.videoId)){
requests.trySend(Request.OnUpdateDownloadUi(bean.videoId))
}else{
updateDownloadUI(currentDownload)
}
} else { } else {
requests.trySend(Request.OnUpdateDownloadUi(bean.videoId)) requests.trySend(Request.OnUpdateDownloadUi(bean.videoId))
} }