Readaround logic tweaks

This commit is contained in:
tarsin committed 2023-02-14 15:35:04 +08:00
1 parent 3941f59bbc
commit d7b08a0181
3 files changed
+1 -12

No files matched your search

@@ -63,14 +63,6 @@ class SpiderQueenWorker(private val queen: SpiderQueen) : CoroutineScope {
fun updateRAList(list: List<Int>) {
if (isDownloadMode) return
synchronized(mFetcherJobMap) {
sequence {
mFetcherJobMap.forEach { (i, job) ->
if (i !in list) {
job.cancel()
}
if (!job.isActive) yield(i)
}
}.toSet().forEach { mFetcherJobMap.remove(it) }
list.forEach {
if (mFetcherJobMap[it]?.isActive != true)
doLaunchDownloadJob(it, false)
@@ -61,9 +61,7 @@ class PagerViewerAdapter(private val viewer: PagerViewer) : ViewPagerAdapter() {
}
}
override fun destroyView(container: ViewGroup, position: Int, view: View) {
currentChapter?.cancelRequest(position)
}
override fun destroyView(container: ViewGroup, position: Int, view: View) {}
/**
* Returns the current position of the given [view] on the adapter.
@@ -84,7 +84,6 @@ class WebtoonAdapter(val viewer: WebtoonViewer) : RecyclerView.Adapter<RecyclerV
* Recycles an existing view [holder] before adding it to the view pool.
*/
override fun onViewRecycled(holder: RecyclerView.ViewHolder) {
currentChapter?.cancelRequest(holder.bindingAdapterPosition)
when (holder) {
is WebtoonPageHolder -> holder.recycle()
}