From 58902371210f99c4d3b86691fe6779d2e30883ae Mon Sep 17 00:00:00 2001 From: gedoor Date: Sat, 29 Aug 2020 18:07:55 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8D=A2=E6=BA=90=E4=B8=8D=E5=9C=A8=E6=94=B9?= =?UTF-8?q?=E5=8F=98=E4=B9=A6=E5=90=8D=E5=92=8C=E4=BD=9C=E8=80=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/legado/app/ui/book/info/BookInfoViewModel.kt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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 8f2ed64c2..71f046826 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 @@ -9,8 +9,8 @@ import io.legado.app.base.BaseViewModel 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.model.localBook.LocalBook +import io.legado.app.model.webBook.WebBook import io.legado.app.service.help.ReadBook import kotlinx.coroutines.Dispatchers.IO @@ -49,15 +49,15 @@ class BookInfoViewModel(application: Application) : BaseViewModel(application) { } fun loadBookInfo( - book: Book, - changeDruChapterIndex: ((chapters: List) -> Unit)? = null + book: Book, canReName: Boolean = true, + changeDruChapterIndex: ((chapters: List) -> Unit)? = null, ) { execute { if (book.isLocalBook()) { loadChapter(book, changeDruChapterIndex) } else { App.db.bookSourceDao().getBookSource(book.origin)?.let { bookSource -> - WebBook(bookSource).getBookInfo(book, this) + WebBook(bookSource).getBookInfo(book, this, canReName = canReName) .onSuccess(IO) { bookData.postValue(book) if (inBookshelf) { @@ -138,7 +138,7 @@ class BookInfoViewModel(application: Application) : BaseViewModel(application) { } bookData.postValue(newBook) if (newBook.tocUrl.isEmpty()) { - loadBookInfo(newBook) { upChangeDurChapterIndex(newBook, it) } + loadBookInfo(newBook, false) { upChangeDurChapterIndex(newBook, it) } } else { loadChapter(newBook) { upChangeDurChapterIndex(newBook, it) } }