From 645319e5a15761cb7ecd08c96af086e519414ee3 Mon Sep 17 00:00:00 2001 From: gedoor Date: Sun, 9 Aug 2020 18:52:03 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=8B=E8=BD=BD=E8=BF=9B?= =?UTF-8?q?=E5=BA=A6=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/java/io/legado/app/service/DownloadService.kt | 1 - .../java/io/legado/app/ui/book/download/DownloadActivity.kt | 4 +++- .../java/io/legado/app/ui/book/download/DownloadAdapter.kt | 4 +++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/io/legado/app/service/DownloadService.kt b/app/src/main/java/io/legado/app/service/DownloadService.kt index d386aef2d..446e7ae06 100644 --- a/app/src/main/java/io/legado/app/service/DownloadService.kt +++ b/app/src/main/java/io/legado/app/service/DownloadService.kt @@ -275,7 +275,6 @@ class DownloadService : BaseService() { startForeground(AppConst.notificationIdDownload, notification) } - class DownloadCount { @Volatile var downloadFinishedCount = 0 // 下载完成的条目数量 diff --git a/app/src/main/java/io/legado/app/ui/book/download/DownloadActivity.kt b/app/src/main/java/io/legado/app/ui/book/download/DownloadActivity.kt index 0d3de4895..ecb9c6b67 100644 --- a/app/src/main/java/io/legado/app/ui/book/download/DownloadActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/download/DownloadActivity.kt @@ -30,6 +30,8 @@ import kotlinx.coroutines.Dispatchers.IO import kotlinx.coroutines.launch import kotlinx.coroutines.withContext import org.jetbrains.anko.toast +import java.util.concurrent.ConcurrentHashMap +import java.util.concurrent.CopyOnWriteArraySet class DownloadActivity : VMBaseActivity(R.layout.activity_download), @@ -172,7 +174,7 @@ class DownloadActivity : VMBaseActivity(R.layout.activity_dow } override fun observeLiveBus() { - observeEvent>>(EventBus.UP_DOWNLOAD) { + observeEvent>>(EventBus.UP_DOWNLOAD) { if (it.isEmpty()) { menu?.findItem(R.id.menu_download)?.setIcon(R.drawable.ic_play_24dp) menu?.applyTint(this) diff --git a/app/src/main/java/io/legado/app/ui/book/download/DownloadAdapter.kt b/app/src/main/java/io/legado/app/ui/book/download/DownloadAdapter.kt index 082e5aecc..3da043450 100644 --- a/app/src/main/java/io/legado/app/ui/book/download/DownloadAdapter.kt +++ b/app/src/main/java/io/legado/app/ui/book/download/DownloadAdapter.kt @@ -10,13 +10,15 @@ import io.legado.app.data.entities.BookChapter import io.legado.app.service.help.Download import kotlinx.android.synthetic.main.item_download.view.* import org.jetbrains.anko.sdk27.listeners.onClick +import java.util.concurrent.ConcurrentHashMap +import java.util.concurrent.CopyOnWriteArraySet class DownloadAdapter(context: Context, private val callBack: CallBack) : SimpleRecyclerAdapter(context, R.layout.item_download) { val cacheChapters = hashMapOf>() - var downloadMap: HashMap>? = null + var downloadMap: ConcurrentHashMap>? = null override fun convert(holder: ItemViewHolder, item: Book, payloads: MutableList) { with(holder.itemView) {