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 { viewModel.bookData.value?.let {
if (!viewModel.inBookshelf) { if (!viewModel.inBookshelf) {
viewModel.saveBook { viewModel.saveBook {
startActivity<ReadBookActivity>(Pair("bookUrl", it.bookUrl)) startActivity<ReadBookActivity>(
Pair("bookUrl", it.bookUrl),
Pair("inBookshelf", false)
)
} }
} else { } else {
startActivity<ReadBookActivity>(Pair("bookUrl", it.bookUrl)) startActivity<ReadBookActivity>(Pair("bookUrl", it.bookUrl))

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

Loading…
Cancel
Save