pull/34/head
kunfei 5 years ago
parent 8e426101c2
commit c464f1cfec
  1. 4
      app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt
  2. 14
      app/src/main/java/io/legado/app/ui/widget/page/PageView.kt

@ -282,12 +282,12 @@ class ReadBookActivity : VMBaseActivity<ReadBookViewModel>(R.layout.activity_rea
viewModel.durChapterIndex - 1 -> launch {
viewModel.prevTextChapter = ChapterProvider
.getTextChapter(content_text_view, bookChapter, content, viewModel.chapterSize)
page_view.upContent()
page_view.upContent(-1)
}
viewModel.durChapterIndex + 1 -> launch {
viewModel.nextTextChapter = ChapterProvider
.getTextChapter(content_text_view, bookChapter, content, viewModel.chapterSize)
page_view.upContent()
page_view.upContent(1)
}
}
}

@ -91,11 +91,17 @@ class PageView(context: Context, attrs: AttributeSet) :
upContent()
}
fun upContent() {
fun upContent(position: Int = 0) {
pageFactory?.let {
prevPage?.setContent(it.previousPage())
curPage?.setContent(it.currentPage())
nextPage?.setContent(it.nextPage())
when (position) {
-1 -> prevPage?.setContent(it.previousPage())
1 -> nextPage?.setContent(it.nextPage())
else -> {
curPage?.setContent(it.currentPage())
nextPage?.setContent(it.nextPage())
prevPage?.setContent(it.previousPage())
}
}
}
callback?.let {
if (isScrollDelegate()) {

Loading…
Cancel
Save