pull/32/head
kunfei 5 years ago
parent c11105d84a
commit 273ddf83b1
  1. 5
      app/src/main/java/io/legado/app/ui/bookinfo/BookInfoActivity.kt
  2. 3
      app/src/main/java/io/legado/app/ui/readbook/ReadBookViewModel.kt

@ -155,7 +155,10 @@ class BookInfoActivity : VMBaseActivity<BookInfoViewModel>(R.layout.activity_boo
viewModel.bookData.value?.let {
if (!viewModel.inBookshelf) {
viewModel.saveBook {
startActivity<ReadBookActivity>(Pair("bookUrl", it.bookUrl))
startActivity<ReadBookActivity>(
Pair("bookUrl", it.bookUrl),
Pair("inBookshelf", false)
)
}
} else {
startActivity<ReadBookActivity>(Pair("bookUrl", it.bookUrl))

@ -17,7 +17,7 @@ import io.legado.app.ui.widget.page.TextChapter
import kotlinx.coroutines.Dispatchers.IO
class ReadBookViewModel(application: Application) : BaseViewModel(application) {
var inBookshelf = false
var bookData = MutableLiveData<Book>()
var chapterSize = 0
var bookSource: BookSource? = null
@ -33,6 +33,7 @@ class ReadBookViewModel(application: Application) : BaseViewModel(application) {
private val loadingLock = "loadingLock"
fun initData(intent: Intent) {
inBookshelf = intent.getBooleanExtra("inBookshelf", true)
val bookUrl = intent.getStringExtra("bookUrl")
if (!bookUrl.isNullOrEmpty()) {
execute {

Loading…
Cancel
Save