From c493fb894d4412593c7a107cd09621a862da1308 Mon Sep 17 00:00:00 2001 From: gedoor Date: Wed, 10 Jun 2020 21:05:02 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/io/legado/app/ui/book/info/BookInfoViewModel.kt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/src/main/java/io/legado/app/ui/book/info/BookInfoViewModel.kt b/app/src/main/java/io/legado/app/ui/book/info/BookInfoViewModel.kt index 60b40e089..53b7366b9 100644 --- a/app/src/main/java/io/legado/app/ui/book/info/BookInfoViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/book/info/BookInfoViewModel.kt @@ -12,6 +12,7 @@ import io.legado.app.help.BookHelp import io.legado.app.model.WebBook import io.legado.app.model.localBook.AnalyzeTxtFile import io.legado.app.model.localBook.LocalBook +import io.legado.app.service.help.ReadBook import kotlinx.coroutines.Dispatchers.IO class BookInfoViewModel(application: Application) : BaseViewModel(application) { @@ -178,6 +179,9 @@ class BookInfoViewModel(application: Application) : BaseViewModel(application) { book.durChapterTitle = it.durChapterTitle } App.db.bookDao().insert(book) + if (ReadBook.book?.name == book.name && ReadBook.book?.author == book.author) { + ReadBook.book = book + } } }.onSuccess { success?.invoke()