Просмотр исходного кода

Merge pull request #1862 from 5151561/PageRemaining

页眉页脚添加PageRemaining
Kudomaga 3 месяцев назад
Родитель
Сommit
5dd057a759

+ 1 - 0
app/src/main/java/io/legado/app/help/config/CustomTipPlaceholder.kt

@@ -26,6 +26,7 @@ enum class CustomTipPlaceholder(
     CHAPTER_SIZE("{ChapterSize}", "ChapterSize", R.string.placeholder_chapter_size),
     PAGE_INDEX("{PageIndex}", "PageIndex", R.string.placeholder_page_index),
     PAGE_SIZE("{PageSize}", "PageSize", R.string.placeholder_page_size),
+    PAGE_REMAINING("{PageRemaining}", "PageRemaining", R.string.placeholder_page_remaining),
     READ_PROGRESS("{ReadProgress}", "ReadProgress", R.string.placeholder_read_progress),
     FULL_PAGE_INDEX("{FullPageIndex}", "FullPageIndex", R.string.placeholder_full_page_index),
     FULL_PAGE_SIZE("{FullPageSize}", "FullPageSize", R.string.placeholder_full_page_size);

+ 7 - 0
app/src/main/java/io/legado/app/ui/book/read/page/PageView.kt

@@ -547,6 +547,12 @@ class PageView(
             val pageSizeInt = textPage.pageSize
             if (pageSizeInt <= 0) "-" else "~$pageSizeInt"
         }
+        val pageRemaining = (textPage.pageSize - textPage.index - 1).coerceAtLeast(0)
+        val pageRemainingDisplay = when {
+            textPage.textChapter.isCompleted -> pageRemaining.toString()
+            textPage.pageSize <= 0 -> "-"
+            else -> "~$pageRemaining"
+        }
         val readProgressDisplay = textPage.readProgress
         val wholeBookPage = ReadBook.getWholeBookPageState(textPage.chapterIndex, textPage.index)
         val fullPageIndexDisplay = wholeBookPage?.currentPage?.toString() ?: pageIndexDisplay
@@ -564,6 +570,7 @@ class PageView(
                 CustomTipPlaceholder.CHAPTER_SIZE -> chapterSizeDisplay
                 CustomTipPlaceholder.PAGE_INDEX -> pageIndexDisplay
                 CustomTipPlaceholder.PAGE_SIZE -> pageSizeDisplay
+                CustomTipPlaceholder.PAGE_REMAINING -> pageRemainingDisplay
                 CustomTipPlaceholder.READ_PROGRESS -> readProgressDisplay
                 CustomTipPlaceholder.FULL_PAGE_INDEX -> fullPageIndexDisplay
                 CustomTipPlaceholder.FULL_PAGE_SIZE -> fullPageSizeDisplay

+ 1 - 0
app/src/main/res/values-zh-rCN/strings.xml

@@ -2386,6 +2386,7 @@
     <string name="placeholder_chapter_size">章节总数</string>
     <string name="placeholder_page_index">当前页码</string>
     <string name="placeholder_page_size">本章页数</string>
+    <string name="placeholder_page_remaining">本章剩余页数</string>
     <string name="placeholder_read_progress">阅读进度</string>
     <string name="placeholder_full_page_index">全文页码</string>
     <string name="placeholder_full_page_size">全文页数</string>

+ 1 - 0
app/src/main/res/values-zh-rHK/strings.xml

@@ -1665,6 +1665,7 @@
     <string name="placeholder_chapter_size">章節總數</string>
     <string name="placeholder_page_index">當前頁碼</string>
     <string name="placeholder_page_size">本章頁數</string>
+    <string name="placeholder_page_remaining">本章剩餘頁數</string>
     <string name="placeholder_read_progress">閱讀進度</string>
     <string name="custom_regex_rule">自訂正則規則</string>
     <string name="custom_tag_colors">自訂標籤顏色</string>

+ 1 - 0
app/src/main/res/values-zh-rTW/strings.xml

@@ -1592,6 +1592,7 @@
     <string name="placeholder_chapter_size">章節總數</string>
     <string name="placeholder_page_index">當前頁碼</string>
     <string name="placeholder_page_size">本章頁數</string>
+    <string name="placeholder_page_remaining">本章剩餘頁數</string>
     <string name="placeholder_read_progress">閱讀進度</string>
     <string name="cover_selected_images_count">已選擇 %1$d 張圖片</string>
     <string name="confirm_skip_to_chapter">是否跳轉到此章節?</string>

+ 1 - 0
app/src/main/res/values/strings.xml

@@ -1212,6 +1212,7 @@
     <string name="placeholder_chapter_size">ChapterSize</string>
     <string name="placeholder_page_index">PageIndex</string>
     <string name="placeholder_page_size">PageSize</string>
+    <string name="placeholder_page_remaining">PageRemaining</string>
     <string name="placeholder_read_progress">ReadProgress</string>
     <string name="placeholder_full_page_index">FullPageIndex</string>
     <string name="placeholder_full_page_size">FullPageSize</string>