From 3fe160100f73d4eb775f34de1b0cc073c21e6501 Mon Sep 17 00:00:00 2001 From: kunfei Date: Sun, 22 Sep 2019 21:18:22 +0800 Subject: [PATCH] up --- .../io/legado/app/ui/widget/page/PageView.kt | 29 +++++++++---------- 1 file changed, 13 insertions(+), 16 deletions(-) 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 f37622f4b..5a1a9e78b 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 @@ -66,25 +66,22 @@ class PageView(context: Context, attrs: AttributeSet) : } fun fillPage(direction: PageDelegate.Direction) { - pageFactory?.let { - when (direction) { - PageDelegate.Direction.PREV -> { - it.moveToPrevious() - upContent() - } - PageDelegate.Direction.NEXT -> { - it.moveToNext() - upContent() + when (direction) { + PageDelegate.Direction.PREV -> { + pageFactory?.moveToPrevious() + upContent() + if (isScrollDelegate()) { + curPage?.scrollToBottom() } - else -> Unit } - } - if (isScrollDelegate()) { - when (direction) { - PageDelegate.Direction.PREV -> curPage?.scrollToBottom() - PageDelegate.Direction.NEXT -> curPage?.scrollTo(0) - else -> Unit + PageDelegate.Direction.NEXT -> { + pageFactory?.moveToNext() + upContent() + if (isScrollDelegate()) { + curPage?.scrollTo(0) + } } + else -> Unit } }