|
@@ -113,11 +113,13 @@ abstract class ReaderActivity : KdanBaseActivity(), ReaderSettingListener, PdfTh
|
|
|
}
|
|
|
|
|
|
private val viewModel: ReaderViewModel by viewModel {
|
|
|
- filePath = intent.getStringExtra(KEY_FILE_ABSOLUTE)
|
|
|
+ val filePath = intent.getStringExtra(KEY_FILE_ABSOLUTE)
|
|
|
if (!filePath.isNullOrEmpty()) {
|
|
|
insertToRecentDocumentList(filePath as String)
|
|
|
}
|
|
|
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)
|
|
|
}
|
|
|
private var isShowPasswordActivity = false
|
|
@@ -158,6 +160,7 @@ abstract class ReaderActivity : KdanBaseActivity(), ReaderSettingListener, PdfTh
|
|
|
setContentView(R.layout.activity_reader)
|
|
|
setSupportActionBar(toolbar_readerActivity)
|
|
|
isShowPasswordActivity = savedInstanceState?.getBoolean(KEY_IS_PASSWORD_ACTIVITY_SHOWING) ?: false
|
|
|
+ // Get file path to determine the opening file is pdf or not
|
|
|
filePath = intent.getStringExtra(KEY_FILE_ABSOLUTE)
|
|
|
|
|
|
val displayMetrics = DisplayMetrics()
|