diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/recently_read/RecentlyReadController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/recently_read/RecentlyReadController.kt index 983cc5ab1e..cbea59b673 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/recently_read/RecentlyReadController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/recently_read/RecentlyReadController.kt @@ -105,16 +105,18 @@ class RecentlyReadController(bundle: Bundle? = null) : BaseController(bundle), * * @param mangaHistory list of manga history */ - fun onNextManga(mangaHistory: List) { + fun onNextManga(mangaHistory: List, freshList:Boolean = false) { val adapter = adapter ?: return adapter.updateDataSet(mangaHistory) adapter.onLoadMoreComplete(null) - if (recentItems == null) + if (recentItems == null || adapter.endlessTargetCount == 1) resetProgressItem() + else if (freshList && mangaHistory.size == recentItems!!.size) + onAddPageError() recentItems = mangaHistory.toMutableList() } - fun onAddPageError() { + private fun onAddPageError() { adapter?.onLoadMoreComplete(null) adapter?.endlessTargetCount = 1 } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/recently_read/RecentlyReadPresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/recently_read/RecentlyReadPresenter.kt index bcf73ba09b..30c0fbbb99 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/recently_read/RecentlyReadPresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/recently_read/RecentlyReadPresenter.kt @@ -55,14 +55,13 @@ class RecentlyReadPresenter(private val view: RecentlyReadController) { } fun observe() { - readerSubscription?.unsubscribe() val cal = Calendar.getInstance() cal.time = Date() cal.add(Calendar.YEAR, -50) - readerSubscription = db.getRecentMangaLimit(cal.time, lastCount, "").asRxObservable().map { + db.getRecentMangaLimit(cal.time, lastCount, "").asRxObservable().map { val items = it.map(::RecentlyReadItem) launchUI { - view.onNextManga(items) + view.onNextManga(items, false) } }.observeOn(Schedulers.io()).skip(1).take(1).subscribe() }