pull/78/head
kunfei 5 years ago
parent cb7bad6c0f
commit c8d0109008
  1. 26
      app/src/main/java/io/legado/app/ui/book/info/BookInfoActivity.kt

@ -217,14 +217,11 @@ class BookInfoActivity :
}
tv_toc.onClick {
if (!viewModel.inBookshelf) {
toast(R.string.after_add_bookshelf)
return@onClick
}
viewModel.bookData.value?.let {
startActivityForResult<ChapterListActivity>(
requestCodeChapterList,
Pair("bookUrl", it.bookUrl)
)
viewModel.saveBook {
openChapterList()
}
} else {
openChapterList()
}
}
tv_group.onClick {
@ -232,6 +229,15 @@ class BookInfoActivity :
}
}
private fun openChapterList() {
viewModel.bookData.value?.let {
startActivityForResult<ChapterListActivity>(
requestCodeChapterList,
Pair("bookUrl", it.bookUrl)
)
}
}
private fun readBook(book: Book) {
if (!viewModel.inBookshelf) {
viewModel.saveBook {
@ -306,6 +312,10 @@ class BookInfoActivity :
readBook(it)
}
}
} else {
if (!viewModel.inBookshelf) {
viewModel.delBook {}
}
}
}
}

Loading…
Cancel
Save