From ee1f04f42cfbe4bdadda06eedd1ee1560c6a716b Mon Sep 17 00:00:00 2001 From: kunfei Date: Tue, 25 Feb 2020 12:05:50 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/io/legado/app/ui/book/read/page/ContentView.kt | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/book/read/page/ContentView.kt b/app/src/main/java/io/legado/app/ui/book/read/page/ContentView.kt index 574020c45..9f2631ea6 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/page/ContentView.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/page/ContentView.kt @@ -15,7 +15,6 @@ import java.util.* class ContentView(context: Context) : FrameLayout(context) { - private var pageSize: Int = 0 init { //设置背景防止切换背景时文字重叠 @@ -26,8 +25,7 @@ class ContentView(context: Context) : FrameLayout(context) { upTime() content_text_view.upView = { tv_bottom_left.text = it.title - pageSize = it.pageSize - setPageIndex(it.index) + setPageIndex(it.index, it.pageSize) } } @@ -97,8 +95,7 @@ class ContentView(context: Context) : FrameLayout(context) { fun setContent(textPage: TextPage) { tv_bottom_left.text = textPage.title - pageSize = textPage.pageSize - setPageIndex(textPage.index) + setPageIndex(textPage.index, textPage.pageSize) content_text_view.resetPageOffset() content_text_view.setContent(textPage) } @@ -108,7 +105,7 @@ class ContentView(context: Context) : FrameLayout(context) { } @SuppressLint("SetTextI18n") - fun setPageIndex(pageIndex: Int?) { + fun setPageIndex(pageIndex: Int?, pageSize: Int) { pageIndex?.let { tv_bottom_right.text = "${pageIndex.plus(1)}/${pageSize}" }