pull/32/head
kunfei 5 years ago
parent fdf12315f4
commit 729979f763
  1. 6
      app/src/main/java/io/legado/app/ui/readbook/ReadBookActivity.kt
  2. 5
      app/src/main/java/io/legado/app/ui/readbook/ReadBookViewModel.kt

@ -236,9 +236,9 @@ class ReadBookActivity : VMBaseActivity<ReadBookViewModel>(R.layout.activity_rea
private fun bookLoadFinish() { private fun bookLoadFinish() {
viewModel.bookData.value?.let { viewModel.bookData.value?.let {
viewModel.loadContent(it, it.durChapterIndex) viewModel.loadContent(it, viewModel.durChapterIndex)
viewModel.loadContent(it, it.durChapterIndex + 1) viewModel.loadContent(it, viewModel.durChapterIndex + 1)
viewModel.loadContent(it, it.durChapterIndex - 1) viewModel.loadContent(it, viewModel.durChapterIndex - 1)
} }
} }

@ -59,6 +59,9 @@ class ReadBookViewModel(application: Application) : BaseViewModel(application) {
toast(R.string.error_load_toc) toast(R.string.error_load_toc)
} ?: autoChangeSource() } ?: autoChangeSource()
} else { } else {
if (durChapterIndex > count - 1) {
durChapterIndex = count - 1
}
chapterMaxIndex.postValue(count) chapterMaxIndex.postValue(count)
} }
} }
@ -81,6 +84,8 @@ class ReadBookViewModel(application: Application) : BaseViewModel(application) {
loadingChapters.remove(index) loadingChapters.remove(index)
} }
} ?: download(book, chapter) } ?: download(book, chapter)
} ?: synchronized(loadingLock) {
loadingChapters.remove(index)
} }
}.onError { }.onError {
synchronized(loadingLock) { synchronized(loadingLock) {

Loading…
Cancel
Save