pull/49/head
kunfei 5 years ago
parent 4669b648af
commit 6c4d5e2e47
  1. 6
      app/src/main/java/io/legado/app/ui/audio/AudioPlayViewModel.kt

@ -9,7 +9,6 @@ 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
import io.legado.app.service.AudioPlayService
import io.legado.app.service.help.AudioPlay
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
@ -18,9 +17,10 @@ class AudioPlayViewModel(application: Application) : BaseViewModel(application)
fun initData(intent: Intent) {
execute {
if (!AudioPlayService.isRun) {
val bookUrl = intent.getStringExtra("bookUrl")
if (AudioPlay.book?.bookUrl != bookUrl) {
AudioPlay.stop(context)
AudioPlay.inBookshelf = intent.getBooleanExtra("inBookshelf", true)
val bookUrl = intent.getStringExtra("bookUrl")
AudioPlay.book = if (!bookUrl.isNullOrEmpty()) {
App.db.bookDao().getBook(bookUrl)
} else {

Loading…
Cancel
Save