Fixed crash with recents swiping

This commit is contained in:
Jay 2020-05-01 14:40:26 -04:00
parent 7a03231ede
commit 79d8d6ba8d
2 changed files with 3 additions and 9 deletions

View File

@ -9,7 +9,6 @@ class RecentChaptersAdapter(val controller: RecentChaptersController) :
val coverClickListener: OnCoverClickListener = controller
var recents = emptyList<RecentChapterItem>()
private var isAnimating = false
init {
setDisplayHeadersAtStartUp(true)
@ -24,11 +23,10 @@ class RecentChaptersAdapter(val controller: RecentChaptersController) :
fun performFilter() {
val s = getFilter(String::class.java)
if (s.isNullOrBlank()) {
updateDataSet(recents, isAnimating)
updateDataSet(recents)
} else {
updateDataSet(recents.filter { it.filter(s) }, isAnimating)
updateDataSet(recents.filter { it.filter(s) })
}
isAnimating = false
}
interface OnCoverClickListener {
@ -37,7 +35,6 @@ class RecentChaptersAdapter(val controller: RecentChaptersController) :
override fun onItemSwiped(position: Int, direction: Int) {
super.onItemSwiped(position, direction)
isAnimating = true
when (direction) {
ItemTouchHelper.LEFT -> controller.toggleMarkAsRead(position)
}

View File

@ -9,14 +9,12 @@ import java.text.DecimalFormatSymbols
class RecentMangaAdapter(val delegate: RecentsInterface) :
BaseChapterAdapter<IFlexible<*>>(delegate) {
private var isAnimating = false
init {
setDisplayHeadersAtStartUp(true)
}
fun updateItems(items: List<IFlexible<*>>?) {
updateDataSet(items, isAnimating)
isAnimating = false
updateDataSet(items)
}
val decimalFormat = DecimalFormat("#.###", DecimalFormatSymbols()
@ -34,7 +32,6 @@ class RecentMangaAdapter(val delegate: RecentsInterface) :
override fun onItemSwiped(position: Int, direction: Int) {
super.onItemSwiped(position, direction)
isAnimating = true
when (direction) {
ItemTouchHelper.LEFT -> delegate.markAsRead(position)
}