|
|
|
@ -217,9 +217,19 @@ class BookInfoActivity : |
|
|
|
|
} |
|
|
|
|
tv_toc.onClick { |
|
|
|
|
if (!viewModel.inBookshelf) { |
|
|
|
|
toast(R.string.after_add_bookshelf) |
|
|
|
|
return@onClick |
|
|
|
|
viewModel.saveBook { |
|
|
|
|
openChapterList() |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
openChapterList() |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
tv_group.onClick { |
|
|
|
|
GroupSelectDialog.show(supportFragmentManager) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private fun openChapterList() { |
|
|
|
|
viewModel.bookData.value?.let { |
|
|
|
|
startActivityForResult<ChapterListActivity>( |
|
|
|
|
requestCodeChapterList, |
|
|
|
@ -227,10 +237,6 @@ class BookInfoActivity : |
|
|
|
|
) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
tv_group.onClick { |
|
|
|
|
GroupSelectDialog.show(supportFragmentManager) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private fun readBook(book: Book) { |
|
|
|
|
if (!viewModel.inBookshelf) { |
|
|
|
@ -306,6 +312,10 @@ class BookInfoActivity : |
|
|
|
|
readBook(it) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
if (!viewModel.inBookshelf) { |
|
|
|
|
viewModel.delBook {} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|