From c464f1cfecfdc2da545a8751eaca12023a20bfa8 Mon Sep 17 00:00:00 2001 From: kunfei Date: Sat, 21 Sep 2019 21:47:21 +0800 Subject: [PATCH] up --- .../io/legado/app/ui/book/read/ReadBookActivity.kt | 4 ++-- .../java/io/legado/app/ui/widget/page/PageView.kt | 14 ++++++++++---- 2 files changed, 12 insertions(+), 6 deletions(-) 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()) {