pull/63/head
kunfei 5 years ago
parent abbc64f356
commit e568c14b04
  1. 4
      app/src/main/java/io/legado/app/data/dao/BookDao.kt
  2. 2
      app/src/main/java/io/legado/app/ui/download/DownloadActivity.kt

@ -17,8 +17,8 @@ interface BookDao {
@Query("SELECT * FROM books WHERE origin = '${BookType.local}' order by durChapterTime desc") @Query("SELECT * FROM books WHERE origin = '${BookType.local}' order by durChapterTime desc")
fun observeLocal(): LiveData<List<Book>> fun observeLocal(): LiveData<List<Book>>
@Query("SELECT * FROM books WHERE origin <> '${BookType.local}' order by durChapterTime desc") @Query("SELECT * FROM books WHERE origin <> '${BookType.local}' and type = 0 order by durChapterTime desc")
fun observeWeb(): LiveData<List<Book>> fun observeDownload(): LiveData<List<Book>>
@Query("SELECT * FROM books WHERE `group` = :group") @Query("SELECT * FROM books WHERE `group` = :group")
fun observeByGroup(group: Int): LiveData<List<Book>> fun observeByGroup(group: Int): LiveData<List<Book>>

@ -55,7 +55,7 @@ class DownloadActivity : BaseActivity(R.layout.activity_download) {
private fun initLiveData() { private fun initLiveData() {
bookshelfLiveData?.removeObservers(this) bookshelfLiveData?.removeObservers(this)
bookshelfLiveData = App.db.bookDao().observeWeb() bookshelfLiveData = App.db.bookDao().observeDownload()
bookshelfLiveData?.observe(this, Observer { bookshelfLiveData?.observe(this, Observer {
adapter.setItems(it) adapter.setItems(it)
}) })

Loading…
Cancel
Save