From 273ddf83b186e3e206a0765db699d3358179f009 Mon Sep 17 00:00:00 2001 From: kunfei Date: Thu, 22 Aug 2019 08:08:50 +0800 Subject: [PATCH] up --- .../main/java/io/legado/app/ui/bookinfo/BookInfoActivity.kt | 5 ++++- .../main/java/io/legado/app/ui/readbook/ReadBookViewModel.kt | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) 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 {