|
|
|
@ -23,6 +23,7 @@ import org.koitharu.kotatsu.base.ui.list.ListSelectionController
|
|
|
|
import org.koitharu.kotatsu.base.ui.list.PaginationScrollListener
|
|
|
|
import org.koitharu.kotatsu.base.ui.list.PaginationScrollListener
|
|
|
|
import org.koitharu.kotatsu.base.ui.list.decor.SpacingItemDecoration
|
|
|
|
import org.koitharu.kotatsu.base.ui.list.decor.SpacingItemDecoration
|
|
|
|
import org.koitharu.kotatsu.base.ui.list.decor.TypedSpacingItemDecoration
|
|
|
|
import org.koitharu.kotatsu.base.ui.list.decor.TypedSpacingItemDecoration
|
|
|
|
|
|
|
|
import org.koitharu.kotatsu.base.ui.list.fastscroll.FastScroller
|
|
|
|
import org.koitharu.kotatsu.browser.cloudflare.CloudFlareDialog
|
|
|
|
import org.koitharu.kotatsu.browser.cloudflare.CloudFlareDialog
|
|
|
|
import org.koitharu.kotatsu.core.exceptions.CloudFlareProtectedException
|
|
|
|
import org.koitharu.kotatsu.core.exceptions.CloudFlareProtectedException
|
|
|
|
import org.koitharu.kotatsu.core.exceptions.resolve.ExceptionResolver
|
|
|
|
import org.koitharu.kotatsu.core.exceptions.resolve.ExceptionResolver
|
|
|
|
@ -48,7 +49,7 @@ abstract class MangaListFragment :
|
|
|
|
PaginationScrollListener.Callback,
|
|
|
|
PaginationScrollListener.Callback,
|
|
|
|
MangaListListener,
|
|
|
|
MangaListListener,
|
|
|
|
SwipeRefreshLayout.OnRefreshListener,
|
|
|
|
SwipeRefreshLayout.OnRefreshListener,
|
|
|
|
ListSelectionController.Callback {
|
|
|
|
ListSelectionController.Callback, FastScroller.FastScrollListener {
|
|
|
|
|
|
|
|
|
|
|
|
private var listAdapter: MangaListAdapter? = null
|
|
|
|
private var listAdapter: MangaListAdapter? = null
|
|
|
|
private var paginationListener: PaginationScrollListener? = null
|
|
|
|
private var paginationListener: PaginationScrollListener? = null
|
|
|
|
@ -88,6 +89,7 @@ abstract class MangaListFragment :
|
|
|
|
adapter = listAdapter
|
|
|
|
adapter = listAdapter
|
|
|
|
checkNotNull(selectionController).attachToRecyclerView(binding.recyclerView)
|
|
|
|
checkNotNull(selectionController).attachToRecyclerView(binding.recyclerView)
|
|
|
|
addOnScrollListener(paginationListener!!)
|
|
|
|
addOnScrollListener(paginationListener!!)
|
|
|
|
|
|
|
|
fastScroller.setFastScrollListener(this@MangaListFragment)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
with(binding.swipeRefreshLayout) {
|
|
|
|
with(binding.swipeRefreshLayout) {
|
|
|
|
setProgressBackgroundColorSchemeColor(context.getThemeColor(com.google.android.material.R.attr.colorPrimary))
|
|
|
|
setProgressBackgroundColorSchemeColor(context.getThemeColor(com.google.android.material.R.attr.colorPrimary))
|
|
|
|
@ -289,6 +291,14 @@ abstract class MangaListFragment :
|
|
|
|
binding.recyclerView.invalidateItemDecorations()
|
|
|
|
binding.recyclerView.invalidateItemDecorations()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
override fun onFastScrollStart(fastScroller: FastScroller) {
|
|
|
|
|
|
|
|
binding.swipeRefreshLayout.isEnabled = false
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
override fun onFastScrollStop(fastScroller: FastScroller) {
|
|
|
|
|
|
|
|
binding.swipeRefreshLayout.isEnabled = isSwipeRefreshEnabled
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private fun collectSelectedItems(): Set<Manga> {
|
|
|
|
private fun collectSelectedItems(): Set<Manga> {
|
|
|
|
val checkedIds = selectionController?.peekCheckedIds() ?: return emptySet()
|
|
|
|
val checkedIds = selectionController?.peekCheckedIds() ?: return emptySet()
|
|
|
|
val items = listAdapter?.items ?: return emptySet()
|
|
|
|
val items = listAdapter?.items ?: return emptySet()
|
|
|
|
|