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.durChapterIndex - 1 -> launch {
viewModel.prevTextChapter = ChapterProvider viewModel.prevTextChapter = ChapterProvider
.getTextChapter(content_text_view, bookChapter, content, viewModel.chapterSize) .getTextChapter(content_text_view, bookChapter, content, viewModel.chapterSize)
page_view.upContent() page_view.upContent(-1)
} }
viewModel.durChapterIndex + 1 -> launch { viewModel.durChapterIndex + 1 -> launch {
viewModel.nextTextChapter = ChapterProvider viewModel.nextTextChapter = ChapterProvider
.getTextChapter(content_text_view, bookChapter, content, viewModel.chapterSize) .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() upContent()
} }
fun upContent() { fun upContent(position: Int = 0) {
pageFactory?.let { pageFactory?.let {
prevPage?.setContent(it.previousPage()) when (position) {
curPage?.setContent(it.currentPage()) -1 -> prevPage?.setContent(it.previousPage())
nextPage?.setContent(it.nextPage()) 1 -> nextPage?.setContent(it.nextPage())
else -> {
curPage?.setContent(it.currentPage())
nextPage?.setContent(it.nextPage())
prevPage?.setContent(it.previousPage())
}
}
} }
callback?.let { callback?.let {
if (isScrollDelegate()) { if (isScrollDelegate()) {

Loading…
Cancel
Save