|
@@ -3,6 +3,7 @@ package com.kdanmobile.reader.additionalpage
|
|
|
import androidx.annotation.IntRange
|
|
|
import com.kdanmobile.kmpdfkit.globaldata.Config
|
|
|
import com.kdanmobile.kmpdfkit.manager.controller.KMPDFDocumentController
|
|
|
+import kotlin.math.max
|
|
|
|
|
|
/**
|
|
|
* 額外頁面頁碼轉換器
|
|
@@ -15,9 +16,9 @@ import com.kdanmobile.kmpdfkit.manager.controller.KMPDFDocumentController
|
|
|
*/
|
|
|
class AdditionalPageConverter(
|
|
|
// 原始文件每隔幾頁是「額外頁面」
|
|
|
- @IntRange(from = 1) private val additionalPageInterval: Int = DEFAULT_ADDITIONAL_PAGE_INTERVAL,
|
|
|
+ @IntRange(from = 1) additionalPageInterval: Int = DEFAULT_ADDITIONAL_PAGE_INTERVAL,
|
|
|
// 第一個額外頁面至少是從原始文件第幾頁開始
|
|
|
- @IntRange(from = 1) private val firstAdditionalPageIndex: Int = DEFAULT_FIRST_ADDITIONAL_PAGE_INDEX
|
|
|
+ @IntRange(from = 1) firstAdditionalPageIndex: Int = DEFAULT_FIRST_ADDITIONAL_PAGE_INDEX
|
|
|
) {
|
|
|
|
|
|
companion object {
|
|
@@ -27,6 +28,10 @@ class AdditionalPageConverter(
|
|
|
const val DEFAULT_FIRST_ADDITIONAL_PAGE_INDEX = 1
|
|
|
}
|
|
|
|
|
|
+ private val additionalPageInterval: Int = max(DEFAULT_ADDITIONAL_PAGE_INTERVAL, additionalPageInterval)
|
|
|
+
|
|
|
+ private val firstAdditionalPageIndex: Int = max(DEFAULT_FIRST_ADDITIONAL_PAGE_INDEX, firstAdditionalPageIndex)
|
|
|
+
|
|
|
var kmpdfDocumentController: KMPDFDocumentController? = null
|
|
|
|
|
|
/**
|