pull/473/head
gedoor 4 years ago
parent 35dcbd9df1
commit 58e56af9f3
  1. 2
      app/src/main/java/io/legado/app/api/controller/BookshelfController.kt
  2. 2
      app/src/main/java/io/legado/app/ui/book/info/BookInfoActivity.kt
  3. 6
      app/src/main/java/io/legado/app/ui/book/info/BookInfoViewModel.kt

@ -78,7 +78,7 @@ object BookshelfController {
val book = GSON.fromJsonObject<Book>(postData)
val returnData = ReturnData()
if (book != null) {
App.db.bookDao().update(book)
App.db.bookDao().insert(book)
if (ReadBook.book?.bookUrl == book.bookUrl) {
ReadBook.book = book
ReadBook.durChapterIndex = book.durChapterIndex

@ -65,6 +65,7 @@ class BookInfoActivity :
scroll_view.setBackgroundColor(backgroundColor)
fl_action.setBackgroundColor(bottomBackground)
tv_shelf.setTextColor(getPrimaryTextColor(ColorUtils.isColorLight(bottomBackground)))
tv_toc.text = getString(R.string.toc_s, getString(R.string.loading))
viewModel.bookData.observe(this, { showBook(it) })
viewModel.chapterListData.observe(this, { upLoading(false, it) })
viewModel.initData(intent)
@ -136,7 +137,6 @@ class BookInfoActivity :
tv_author.text = getString(R.string.author_show, book.getRealAuthor())
tv_origin.text = getString(R.string.origin_show, book.originName)
tv_lasted.text = getString(R.string.lasted_show, book.latestChapterTitle)
tv_toc.text = getString(R.string.toc_s, getString(R.string.loading))
tv_intro.text = book.getDisplayIntro()
upTvBookshelf()
val kinds = book.getKindList()

@ -179,11 +179,7 @@ class BookInfoViewModel(application: Application) : BaseViewModel(application) {
book.durChapterPos = it.durChapterPos
book.durChapterTitle = it.durChapterTitle
}
if (App.db.bookDao().getBook(book.bookUrl) != null) {
App.db.bookDao().update(book)
} else {
App.db.bookDao().insert(book)
}
App.db.bookDao().insert(book)
if (ReadBook.book?.name == book.name && ReadBook.book?.author == book.author) {
ReadBook.book = book
}

Loading…
Cancel
Save