修复阅读界面加入书架后,书籍详情页还是显示加入书架按钮的bug

pull/300/head
gedoor 4 years ago
parent 7a06e8e90a
commit 439997a1dc
  1. 3
      app/src/main/assets/updateLog.md
  2. 14
      app/src/main/java/io/legado/app/ui/book/info/BookInfoActivity.kt
  3. 5
      app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt

@ -3,6 +3,9 @@
* 请关注公众号[开源阅读]()支持我,同时关注合作公众号[小说拾遗](),阅读公众号小编。
* 公众号会发布更新,请去公众号下载官方版本,防止软件包被篡改。
**2020/08/09**
* 修复阅读界面加入书架后,书籍详情页还是显示加入书架按钮的bug
**2020/08/08**
* 继续适配主题,现在应该所有地方都按照主题变色了
* 朗读定时增加到3个小时,朗读暂停恢复后继续定时

@ -55,6 +55,7 @@ class BookInfoActivity :
private val requestCodeChapterList = 568
private val requestCodeSourceEdit = 562
private val requestCodeRead = 432
override val viewModel: BookInfoViewModel
get() = getViewModel(BookInfoViewModel::class.java)
@ -309,7 +310,8 @@ class BookInfoActivity :
Pair("bookUrl", book.bookUrl),
Pair("inBookshelf", viewModel.inBookshelf)
)
else -> startActivity<ReadBookActivity>(
else -> startActivityForResult<ReadBookActivity>(
requestCodeRead,
Pair("bookUrl", book.bookUrl),
Pair("inBookshelf", viewModel.inBookshelf),
Pair("key", IntentDataHelp.putData(book))
@ -358,10 +360,12 @@ class BookInfoActivity :
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
when (requestCode) {
requestCodeSourceEdit -> if (resultCode == Activity.RESULT_OK) {
requestCodeSourceEdit ->
if (resultCode == Activity.RESULT_OK) {
viewModel.upEditBook()
}
requestCodeChapterList -> if (resultCode == Activity.RESULT_OK) {
requestCodeChapterList ->
if (resultCode == Activity.RESULT_OK) {
viewModel.bookData.value?.let {
data?.getIntExtra("index", it.durChapterIndex)?.let { index ->
if (it.durChapterIndex != index) {
@ -376,6 +380,10 @@ class BookInfoActivity :
viewModel.delBook()
}
}
requestCodeRead -> if (resultCode == Activity.RESULT_OK) {
viewModel.inBookshelf = true
upTvBookshelf()
}
}
}
}

@ -740,7 +740,10 @@ class ReadBookActivity : VMBaseActivity<ReadBookViewModel>(R.layout.activity_boo
if (!ReadBook.inBookshelf) {
this.alert(title = getString(R.string.add_to_shelf)) {
message = getString(R.string.check_add_bookshelf, it.name)
okButton { ReadBook.inBookshelf = true }
okButton {
ReadBook.inBookshelf = true
setResult(Activity.RESULT_OK)
}
noButton { viewModel.removeFromBookshelf { super.finish() } }
}.show().applyTint()
} else {

Loading…
Cancel
Save