From 4cd983f331efa19c6dcb1051eccb0ee456d92070 Mon Sep 17 00:00:00 2001 From: kunfei Date: Mon, 23 Sep 2019 09:06:49 +0800 Subject: [PATCH] up --- .../io/legado/app/ui/widget/page/ContentView.kt | 1 + .../io/legado/app/ui/widget/page/PageView.kt | 16 ++++++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/widget/page/ContentView.kt b/app/src/main/java/io/legado/app/ui/widget/page/ContentView.kt index bcde1f376..a3a9639b9 100644 --- a/app/src/main/java/io/legado/app/ui/widget/page/ContentView.kt +++ b/app/src/main/java/io/legado/app/ui/widget/page/ContentView.kt @@ -53,6 +53,7 @@ class ContentView : FrameLayout { } if (content_text_view.atBottom()) { setPageIndex(pageSize - 1) + callBack?.scrollToLast() } } } 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 447b6b1e6..12b90dae2 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 @@ -221,16 +221,20 @@ class PageView(context: Context, attrs: AttributeSet) : } override fun scrollToLine(line: Int) { - callback?.textChapter()?.let { - val pageIndex = it.getPageIndex(line) - curPage?.setPageIndex(pageIndex) - callback?.setPageIndex(pageIndex) + if (isScrollDelegate()) { + callback?.textChapter()?.let { + val pageIndex = it.getPageIndex(line) + curPage?.setPageIndex(pageIndex) + callback?.setPageIndex(pageIndex) + } } } override fun scrollToLast() { - callback?.textChapter()?.let { - callback?.setPageIndex(it.lastIndex()) + if (isScrollDelegate()) { + callback?.textChapter()?.let { + callback?.setPageIndex(it.lastIndex()) + } } }