From 3bf94f8cc0476efd34fcc52053fde34caa5a5181 Mon Sep 17 00:00:00 2001 From: kunfei Date: Sun, 1 Mar 2020 10:30:43 +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 --- .../io/legado/app/ui/book/read/page/TextPageFactory.kt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/src/main/java/io/legado/app/ui/book/read/page/TextPageFactory.kt b/app/src/main/java/io/legado/app/ui/book/read/page/TextPageFactory.kt index fe18f1b26..8d08a45ca 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/page/TextPageFactory.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/page/TextPageFactory.kt @@ -68,6 +68,9 @@ class TextPageFactory(dataSource: DataSource) : PageFactory(dataSource ?: TextPage(title = it.title).format() } } + if (!hasNextChapter()) { + return@with TextPage(text = "") + } nextChapter?.let { return@with it.page(0)?.removePageAloudSpan() ?: TextPage(title = it.title).format() @@ -83,6 +86,9 @@ class TextPageFactory(dataSource: DataSource) : PageFactory(dataSource ?: TextPage(title = it.title).format() } } + if (!hasPrevChapter()) { + return@with TextPage(text = "") + } prevChapter?.let { return@with it.lastPage()?.removePageAloudSpan() ?: TextPage(title = it.title).format() @@ -97,6 +103,9 @@ class TextPageFactory(dataSource: DataSource) : PageFactory(dataSource return@with it.page(pageIndex + 2)?.removePageAloudSpan() ?: TextPage(title = it.title).format() } + if (!hasNextChapter()) { + TextPage(text = "") + } nextChapter?.let { nc -> if (pageIndex < it.pageSize() - 1) { return@with nc.page(0)?.removePageAloudSpan()