Resolve #814
This commit is contained in:
1 parent
f099b74aa6
commit
eeed0720f7
3 files changed
+6
-4
No files matched your search
@@ -61,8 +61,8 @@ abstract class PageLoader {
|
|||||||
|
|
||||||
protected abstract fun onForceRequest(index: Int)
|
protected abstract fun onForceRequest(index: Int)
|
||||||
|
|
||||||
fun cancelRequest(index: Int) {
|
fun cancelRequest(page: ReaderPage) {
|
||||||
onCancelRequest(index)
|
onCancelRequest(mPages.indexOf(page))
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract fun onCancelRequest(index: Int)
|
protected abstract fun onCancelRequest(index: Int)
|
||||||
|
|||||||
@@ -62,7 +62,8 @@ class PagerViewerAdapter(private val viewer: PagerViewer) : ViewPagerAdapter() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun destroyView(container: ViewGroup, position: Int, view: View) {
|
override fun destroyView(container: ViewGroup, position: Int, view: View) {
|
||||||
currentChapter?.cancelRequest(position)
|
val item = items[position]
|
||||||
|
currentChapter?.cancelRequest(item as ReaderPage)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -84,10 +84,11 @@ class WebtoonAdapter(val viewer: WebtoonViewer) : RecyclerView.Adapter<RecyclerV
|
|||||||
* Recycles an existing view [holder] before adding it to the view pool.
|
* Recycles an existing view [holder] before adding it to the view pool.
|
||||||
*/
|
*/
|
||||||
override fun onViewRecycled(holder: RecyclerView.ViewHolder) {
|
override fun onViewRecycled(holder: RecyclerView.ViewHolder) {
|
||||||
currentChapter?.cancelRequest(holder.bindingAdapterPosition)
|
|
||||||
when (holder) {
|
when (holder) {
|
||||||
is WebtoonPageHolder -> holder.recycle()
|
is WebtoonPageHolder -> holder.recycle()
|
||||||
}
|
}
|
||||||
|
val item = items.getOrNull(holder.bindingAdapterPosition) ?: return
|
||||||
|
currentChapter?.cancelRequest(item as ReaderPage)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user