From 5970604607bf466fbee7f90eaae8dfb6fe9a26d6 Mon Sep 17 00:00:00 2001 From: kunfei Date: Sun, 25 Aug 2019 22:15:01 +0800 Subject: [PATCH] up --- .../app/ui/widget/page/TextPageFactory.kt | 30 +++++++++++++++---- 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/widget/page/TextPageFactory.kt b/app/src/main/java/io/legado/app/ui/widget/page/TextPageFactory.kt index 0cc47789e..d681f2b58 100644 --- a/app/src/main/java/io/legado/app/ui/widget/page/TextPageFactory.kt +++ b/app/src/main/java/io/legado/app/ui/widget/page/TextPageFactory.kt @@ -1,5 +1,8 @@ package io.legado.app.ui.widget.page +import io.legado.app.App +import io.legado.app.R + class TextPageFactory private constructor(dataSource: DataSource) : PageFactory(dataSource) { @@ -63,28 +66,43 @@ class TextPageFactory private constructor(dataSource: DataSource) : override fun currentPage(): TextPage? = dataSource.pageIndex().let { index -> return dataSource.getCurrentChapter()?.page(index) - ?: TextPage(index, "index:$index", "index:$index") + ?: TextPage(index, App.INSTANCE.getString(R.string.data_loading), "index:$index") } override fun nextPage(): TextPage? = dataSource.pageIndex().let { index -> dataSource.getCurrentChapter()?.let { if (index < it.pageSize() - 1) { return dataSource.getCurrentChapter()?.page(index + 1) - ?: TextPage(index + 1, "index:${index + 1}", "index:${index + 1}") + ?: TextPage( + index + 1, + App.INSTANCE.getString(R.string.data_loading), + "index:${index + 1}" + ) } } return dataSource.getNextChapter()?.page(0) - ?: TextPage(index + 1, "index:${index + 1}", "index:${index + 1}") + ?: TextPage( + index + 1, + App.INSTANCE.getString(R.string.data_loading), + "index:${index + 1}" + ) } override fun previousPage(): TextPage? = dataSource.pageIndex().let { index -> if (index > 0) { return dataSource.getCurrentChapter()?.page(index - 1) - ?: TextPage(index - 1, "index:${index - 1}", "index:${index - 1}") + ?: TextPage( + index - 1, + App.INSTANCE.getString(R.string.data_loading), + "index:${index - 1}" + ) } - return dataSource.getPreviousChapter()?.lastPage() - ?: TextPage(index - 1, "index:${index - 1}", "index:${index - 1}") + ?: TextPage( + index - 1, + App.INSTANCE.getString(R.string.data_loading), + "index:${index - 1}" + ) }