From 3002eac71c899c301546c37f7676f6363b88c9bc Mon Sep 17 00:00:00 2001 From: kunfei Date: Sun, 15 Dec 2019 18:35:59 +0800 Subject: [PATCH] up --- .../main/java/io/legado/app/ui/book/read/ReadBookActivity.kt | 4 +++- app/src/main/java/io/legado/app/ui/widget/page/TextChapter.kt | 2 +- 2 files changed, 4 insertions(+), 2 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 9e584ca86..11c9dc5cf 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 @@ -256,7 +256,9 @@ class ReadBookActivity : VMBaseActivity(R.layout.activity_boo } override fun upContent(position: Int) { - page_view.upContent(position) + launch { + page_view.upContent(position) + } } override fun upView() { diff --git a/app/src/main/java/io/legado/app/ui/widget/page/TextChapter.kt b/app/src/main/java/io/legado/app/ui/widget/page/TextChapter.kt index b6e18a834..fdb9e4e2b 100644 --- a/app/src/main/java/io/legado/app/ui/widget/page/TextChapter.kt +++ b/app/src/main/java/io/legado/app/ui/widget/page/TextChapter.kt @@ -55,7 +55,7 @@ data class TextChapter( fun getReadLength(pageIndex: Int): Int { var length = 0 val maxIndex = min(pageIndex, pageLines.lastIndex) - for (index in 0 until maxIndex) { + for (index in 0..maxIndex) { length += pageLengths[index] } return length