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

Loading…
Cancel
Save