pull/52/head
kunfei 5 years ago
parent 31eef981a0
commit e8fb9b0694
  1. 3
      app/src/main/java/io/legado/app/data/dao/BookDao.kt
  2. 5
      app/src/main/java/io/legado/app/ui/main/bookshelf/BookshelfViewModel.kt

@ -32,6 +32,9 @@ interface BookDao {
@Query("SELECT * FROM books WHERE bookUrl = :bookUrl")
fun getBook(bookUrl: String): Book?
@get:Query("SELECT * FROM books where origin <> '${BookType.local}'")
val webBooks: List<Book>
@get:Query("SELECT * FROM books")
val allBooks: List<Book>

@ -4,6 +4,7 @@ import android.app.Application
import io.legado.app.App
import io.legado.app.base.BaseViewModel
import io.legado.app.data.entities.BookGroup
import io.legado.app.service.help.Download
class BookshelfViewModel(application: Application) : BaseViewModel(application) {
@ -34,8 +35,8 @@ class BookshelfViewModel(application: Application) : BaseViewModel(application)
fun downloadAll() {
execute {
App.db.bookDao().allBooks.forEach { book ->
App.db.bookDao().webBooks.forEach { book ->
Download.start(context, book.bookUrl, book.durChapterIndex, book.totalChapterNum)
}
}
}

Loading…
Cancel
Save