diff --git a/app/src/main/java/io/legado/app/ui/bookinfo/BookInfoActivity.kt b/app/src/main/java/io/legado/app/ui/bookinfo/BookInfoActivity.kt index c2a8de623..88db8e75b 100644 --- a/app/src/main/java/io/legado/app/ui/bookinfo/BookInfoActivity.kt +++ b/app/src/main/java/io/legado/app/ui/bookinfo/BookInfoActivity.kt @@ -155,7 +155,10 @@ class BookInfoActivity : VMBaseActivity(R.layout.activity_boo viewModel.bookData.value?.let { if (!viewModel.inBookshelf) { viewModel.saveBook { - startActivity(Pair("bookUrl", it.bookUrl)) + startActivity( + Pair("bookUrl", it.bookUrl), + Pair("inBookshelf", false) + ) } } else { startActivity(Pair("bookUrl", it.bookUrl)) diff --git a/app/src/main/java/io/legado/app/ui/readbook/ReadBookViewModel.kt b/app/src/main/java/io/legado/app/ui/readbook/ReadBookViewModel.kt index d44c15b03..8527ada13 100644 --- a/app/src/main/java/io/legado/app/ui/readbook/ReadBookViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/readbook/ReadBookViewModel.kt @@ -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() 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 {