diff --git a/app/src/main/java/io/legado/app/ui/bookshelf/BookshelfActivity.kt b/app/src/main/java/io/legado/app/ui/bookshelf/BookshelfActivity.kt index f0af48ac7..61baf35bb 100644 --- a/app/src/main/java/io/legado/app/ui/bookshelf/BookshelfActivity.kt +++ b/app/src/main/java/io/legado/app/ui/bookshelf/BookshelfActivity.kt @@ -44,19 +44,30 @@ class BookshelfActivity : BaseActivity() { private fun upRecyclerData() { viewModel.bookGroup?.let { + bookshelfLiveData?.removeObservers(this) when (it.groupId) { -1 -> { - bookshelfLiveData?.removeObservers(this) + bookshelfLiveData = LivePagedListBuilder(App.db.bookDao().observeAll(), 10).build() - bookshelfLiveData?.observe( - this, - Observer { pageList -> bookshelfAdapter.submitList(pageList) }) } - else -> { + -2 -> { + + } + -3 -> { } + else -> { + bookshelfLiveData = + LivePagedListBuilder( + App.db.bookDao().observeByGroup(it.groupId), + 10 + ).build() + } } + bookshelfLiveData?.observe( + this, + Observer { pageList -> bookshelfAdapter.submitList(pageList) }) } }