pull/508/head
gedoor 4 years ago
parent 1c79ef272f
commit daf37f74b4
  1. 5
      app/src/main/java/io/legado/app/ui/audio/AudioPlayViewModel.kt

@ -5,11 +5,13 @@ import android.content.Intent
import io.legado.app.App
import io.legado.app.R
import io.legado.app.base.BaseViewModel
import io.legado.app.constant.EventBus
import io.legado.app.data.entities.Book
import io.legado.app.data.entities.BookChapter
import io.legado.app.help.BookHelp
import io.legado.app.model.webBook.WebBook
import io.legado.app.service.help.AudioPlay
import io.legado.app.utils.postEvent
import kotlinx.coroutines.Dispatchers
class AudioPlayViewModel(application: Application) : BaseViewModel(application) {
@ -30,6 +32,9 @@ class AudioPlayViewModel(application: Application) : BaseViewModel(application)
AudioPlay.coverData.postValue(book.getDisplayCover())
AudioPlay.durChapterIndex = book.durChapterIndex
AudioPlay.durPageIndex = book.durChapterPos
App.db.bookChapterDao().getChapter(book.bookUrl, book.durChapterIndex)?.let {
postEvent(EventBus.AUDIO_SUB_TITLE, it.title)
}
App.db.bookSourceDao().getBookSource(book.origin)?.let {
AudioPlay.webBook = WebBook(it)
}

Loading…
Cancel
Save