|
@@ -82,6 +82,7 @@ abstract class ReaderActivity :
|
|
|
open fun onFilePathOrUriError(filePath: String?) { println("onFilePathOrUriError: $filePath") }
|
|
|
// 子類別可複寫此方法以客製化KMPDFPageAdapter
|
|
|
abstract fun providePdfPageAdapter(context: Context, filePickerSupport: FilePicker.FilePickerSupport, kmpdfFactory: KMPDFFactory): KMPDFPageAdapter
|
|
|
+ open fun provideAdditionalPageManager(): AdditionalPageManager = AdditionalPageManager()
|
|
|
protected open fun onEvent(hookEvent: HookEvent) { /* do nothing */ }
|
|
|
|
|
|
companion object {
|
|
@@ -126,6 +127,7 @@ abstract class ReaderActivity :
|
|
|
}
|
|
|
|
|
|
private val viewModel: ReaderViewModel by viewModel {
|
|
|
+ val additionalPageManager = provideAdditionalPageManager()
|
|
|
val filePath = intent.getStringExtra(KEY_FILE_ABSOLUTE)
|
|
|
if (!filePath.isNullOrEmpty()) {
|
|
|
insertToRecentDocumentList(filePath as String)
|
|
@@ -133,7 +135,7 @@ abstract class ReaderActivity :
|
|
|
val uri = if (!filePath.isNullOrEmpty()) Uri.parse(Uri.encode(filePath)) else null
|
|
|
// The URI may be null in some special case.
|
|
|
// Just use Uri.EMPTY and show an alert dialog in onCreate() when the uri is null.
|
|
|
- parametersOf(uri ?: Uri.EMPTY)
|
|
|
+ parametersOf(additionalPageManager, uri ?: Uri.EMPTY)
|
|
|
}
|
|
|
private var isShowPasswordActivity = false
|
|
|
|