diff --git a/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt b/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt index bfcebfff5..157aa7945 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt @@ -282,12 +282,12 @@ class ReadBookActivity : VMBaseActivity(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) } } } diff --git a/app/src/main/java/io/legado/app/ui/widget/page/PageView.kt b/app/src/main/java/io/legado/app/ui/widget/page/PageView.kt index 2df6e694e..ca4d9b633 100644 --- a/app/src/main/java/io/legado/app/ui/widget/page/PageView.kt +++ b/app/src/main/java/io/legado/app/ui/widget/page/PageView.kt @@ -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()) {