From cb7bad6c0faee6136162de97c1583b4c6b5cacbb Mon Sep 17 00:00:00 2001 From: kunfei Date: Sat, 25 Jan 2020 11:06:44 +0800 Subject: [PATCH] up --- .../java/io/legado/app/ui/book/info/BookInfoActivity.kt | 8 +++++++- .../java/io/legado/app/ui/book/info/BookInfoViewModel.kt | 1 - 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/book/info/BookInfoActivity.kt b/app/src/main/java/io/legado/app/ui/book/info/BookInfoActivity.kt index 98128c2f2..e637d3eb5 100644 --- a/app/src/main/java/io/legado/app/ui/book/info/BookInfoActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/info/BookInfoActivity.kt @@ -298,7 +298,13 @@ class BookInfoActivity : } requestCodeChapterList -> if (resultCode == Activity.RESULT_OK) { viewModel.bookData.value?.let { - readBook(it) + data?.getIntExtra("index", it.durChapterIndex)?.let { index -> + if (it.durChapterIndex != index) { + it.durChapterIndex = index + it.durChapterPos = 0 + } + readBook(it) + } } } } diff --git a/app/src/main/java/io/legado/app/ui/book/info/BookInfoViewModel.kt b/app/src/main/java/io/legado/app/ui/book/info/BookInfoViewModel.kt index bace352ff..d7d7b0ab1 100644 --- a/app/src/main/java/io/legado/app/ui/book/info/BookInfoViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/book/info/BookInfoViewModel.kt @@ -14,7 +14,6 @@ import io.legado.app.model.WebBook import kotlinx.coroutines.Dispatchers.IO class BookInfoViewModel(application: Application) : BaseViewModel(application) { - val bookData = MutableLiveData() val chapterListData = MutableLiveData>() val isLoadingData = MutableLiveData()