Fix recent item not showing after swiped

This commit is contained in:
Jay 2020-04-13 02:51:23 -04:00
parent f297444d19
commit e87f0c48ce
3 changed files with 9 additions and 2 deletions

View File

@ -9,10 +9,16 @@ 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<*>>?) {
updateDataSet(items, isAnimating)
isAnimating = false
}
val decimalFormat = DecimalFormat("#.###", DecimalFormatSymbols() val decimalFormat = DecimalFormat("#.###", DecimalFormatSymbols()
.apply { decimalSeparator = '.' }) .apply { decimalSeparator = '.' })
@ -28,6 +34,7 @@ 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)
} }

View File

@ -31,7 +31,7 @@ class RecentMangaItem(
} }
override fun isSwipeable(): Boolean { override fun isSwipeable(): Boolean {
return mch.manga.id != null return mch.manga.id != null && !chapter.read
} }
override fun equals(other: Any?): Boolean { override fun equals(other: Any?): Boolean {

View File

@ -227,7 +227,7 @@ class RecentsController(bundle: Bundle? = null) : BaseController(bundle),
fun showLists(recents: List<RecentMangaItem>) { fun showLists(recents: List<RecentMangaItem>) {
swipe_refresh.isRefreshing = LibraryUpdateService.isRunning() swipe_refresh.isRefreshing = LibraryUpdateService.isRunning()
adapter.updateDataSet(recents) adapter.updateItems(recents)
adapter.removeAllScrollableHeaders() adapter.removeAllScrollableHeaders()
if (presenter.viewType > 0) if (presenter.viewType > 0)
adapter.addScrollableHeader(presenter.generalHeader) adapter.addScrollableHeader(presenter.generalHeader)