From e87f0c48ceb9aab1e8f3f91878adb2e79e71597a Mon Sep 17 00:00:00 2001 From: Jay Date: Mon, 13 Apr 2020 02:51:23 -0400 Subject: [PATCH] Fix recent item not showing after swiped --- .../eu/kanade/tachiyomi/ui/recents/RecentMangaAdapter.kt | 7 +++++++ .../java/eu/kanade/tachiyomi/ui/recents/RecentMangaItem.kt | 2 +- .../eu/kanade/tachiyomi/ui/recents/RecentsController.kt | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/recents/RecentMangaAdapter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/recents/RecentMangaAdapter.kt index a7ed1d7b31..94e1fd4d26 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/recents/RecentMangaAdapter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/recents/RecentMangaAdapter.kt @@ -9,10 +9,16 @@ import java.text.DecimalFormatSymbols class RecentMangaAdapter(val delegate: RecentsInterface) : BaseChapterAdapter>(delegate) { + private var isAnimating = false init { setDisplayHeadersAtStartUp(true) } + fun updateItems(items: List>?) { + updateDataSet(items, isAnimating) + isAnimating = false + } + val decimalFormat = DecimalFormat("#.###", DecimalFormatSymbols() .apply { decimalSeparator = '.' }) @@ -28,6 +34,7 @@ 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) } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/recents/RecentMangaItem.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/recents/RecentMangaItem.kt index 060820c6ee..21698e4237 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/recents/RecentMangaItem.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/recents/RecentMangaItem.kt @@ -31,7 +31,7 @@ class RecentMangaItem( } override fun isSwipeable(): Boolean { - return mch.manga.id != null + return mch.manga.id != null && !chapter.read } override fun equals(other: Any?): Boolean { diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/recents/RecentsController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/recents/RecentsController.kt index 915adcdd57..7b0d8fe8e5 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/recents/RecentsController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/recents/RecentsController.kt @@ -227,7 +227,7 @@ class RecentsController(bundle: Bundle? = null) : BaseController(bundle), fun showLists(recents: List) { swipe_refresh.isRefreshing = LibraryUpdateService.isRunning() - adapter.updateDataSet(recents) + adapter.updateItems(recents) adapter.removeAllScrollableHeaders() if (presenter.viewType > 0) adapter.addScrollableHeader(presenter.generalHeader)