pull/42/head
kunfei 5 years ago
parent 02d5cb36dd
commit befe856e75
  1. 14
      app/src/main/java/io/legado/app/ui/main/bookshelf/BooksFragment.kt

@ -86,14 +86,12 @@ class BooksFragment : VMBaseFragment<BooksViewModel>(R.layout.fragment_books),
-3 -> App.db.bookDao().observeAudio() -3 -> App.db.bookDao().observeAudio()
else -> App.db.bookDao().observeByGroup(groupId) else -> App.db.bookDao().observeByGroup(groupId)
} }
bookshelfLiveData?.observe( bookshelfLiveData?.observe(this, Observer {
this, val diffResult =
Observer { DiffUtil.calculateDiff(BooksDiffCallBack(booksAdapter.getItems(), it))
val diffResult = booksAdapter.setItems(it, false)
DiffUtil.calculateDiff(BooksDiffCallBack(booksAdapter.getItems(), it)) diffResult.dispatchUpdatesTo(booksAdapter)
booksAdapter.setItems(it, false) })
diffResult.dispatchUpdatesTo(booksAdapter)
})
} }
override fun open(book: Book) { override fun open(book: Book) {

Loading…
Cancel
Save