mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-14 05:45:10 +01:00
Fixed crash with recents swiping
This commit is contained in:
parent
7a03231ede
commit
79d8d6ba8d
@ -9,7 +9,6 @@ class RecentChaptersAdapter(val controller: RecentChaptersController) :
|
|||||||
|
|
||||||
val coverClickListener: OnCoverClickListener = controller
|
val coverClickListener: OnCoverClickListener = controller
|
||||||
var recents = emptyList<RecentChapterItem>()
|
var recents = emptyList<RecentChapterItem>()
|
||||||
private var isAnimating = false
|
|
||||||
|
|
||||||
init {
|
init {
|
||||||
setDisplayHeadersAtStartUp(true)
|
setDisplayHeadersAtStartUp(true)
|
||||||
@ -24,11 +23,10 @@ class RecentChaptersAdapter(val controller: RecentChaptersController) :
|
|||||||
fun performFilter() {
|
fun performFilter() {
|
||||||
val s = getFilter(String::class.java)
|
val s = getFilter(String::class.java)
|
||||||
if (s.isNullOrBlank()) {
|
if (s.isNullOrBlank()) {
|
||||||
updateDataSet(recents, isAnimating)
|
updateDataSet(recents)
|
||||||
} else {
|
} else {
|
||||||
updateDataSet(recents.filter { it.filter(s) }, isAnimating)
|
updateDataSet(recents.filter { it.filter(s) })
|
||||||
}
|
}
|
||||||
isAnimating = false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
interface OnCoverClickListener {
|
interface OnCoverClickListener {
|
||||||
@ -37,7 +35,6 @@ class RecentChaptersAdapter(val controller: RecentChaptersController) :
|
|||||||
|
|
||||||
override fun onItemSwiped(position: Int, direction: Int) {
|
override fun onItemSwiped(position: Int, direction: Int) {
|
||||||
super.onItemSwiped(position, direction)
|
super.onItemSwiped(position, direction)
|
||||||
isAnimating = true
|
|
||||||
when (direction) {
|
when (direction) {
|
||||||
ItemTouchHelper.LEFT -> controller.toggleMarkAsRead(position)
|
ItemTouchHelper.LEFT -> controller.toggleMarkAsRead(position)
|
||||||
}
|
}
|
||||||
|
@ -9,14 +9,12 @@ import java.text.DecimalFormatSymbols
|
|||||||
class RecentMangaAdapter(val delegate: RecentsInterface) :
|
class RecentMangaAdapter(val delegate: RecentsInterface) :
|
||||||
BaseChapterAdapter<IFlexible<*>>(delegate) {
|
BaseChapterAdapter<IFlexible<*>>(delegate) {
|
||||||
|
|
||||||
private var isAnimating = false
|
|
||||||
init {
|
init {
|
||||||
setDisplayHeadersAtStartUp(true)
|
setDisplayHeadersAtStartUp(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun updateItems(items: List<IFlexible<*>>?) {
|
fun updateItems(items: List<IFlexible<*>>?) {
|
||||||
updateDataSet(items, isAnimating)
|
updateDataSet(items)
|
||||||
isAnimating = false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
val decimalFormat = DecimalFormat("#.###", DecimalFormatSymbols()
|
val decimalFormat = DecimalFormat("#.###", DecimalFormatSymbols()
|
||||||
@ -34,7 +32,6 @@ class RecentMangaAdapter(val delegate: RecentsInterface) :
|
|||||||
|
|
||||||
override fun onItemSwiped(position: Int, direction: Int) {
|
override fun onItemSwiped(position: Int, direction: Int) {
|
||||||
super.onItemSwiped(position, direction)
|
super.onItemSwiped(position, direction)
|
||||||
isAnimating = true
|
|
||||||
when (direction) {
|
when (direction) {
|
||||||
ItemTouchHelper.LEFT -> delegate.markAsRead(position)
|
ItemTouchHelper.LEFT -> delegate.markAsRead(position)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user