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) {