|
@@ -172,20 +172,17 @@ abstract class ReaderActivity : AppCompatActivity() {
|
|
|
val hasOpened = null != filePath
|
|
|
if (isShowPasswordActivity) return@also
|
|
|
if (isOpened) return@also
|
|
|
- val uri = if (intent.action == Intent.ACTION_VIEW) {
|
|
|
- val uri = intent.data
|
|
|
- filePath = UriToPathUtil.getInstance().getPath(applicationContext, uri)
|
|
|
- uri
|
|
|
+ filePath = if (intent.action == Intent.ACTION_VIEW) {
|
|
|
+ UriToPathUtil.getInstance().getPath(applicationContext, intent.data)
|
|
|
} else {
|
|
|
- filePath = intent.getStringExtra(KEY_FILE_ABSOLUTE)
|
|
|
- Uri.parse(filePath)
|
|
|
+ intent.getStringExtra(KEY_FILE_ABSOLUTE)
|
|
|
}
|
|
|
if (!hasOpened && !filePath.isNullOrEmpty()) {
|
|
|
val copyMode = if (copyFile) FileUtil.CopyMode.CREATE_NEW_FILE else FileUtil.CopyMode.DO_NOTHING
|
|
|
filePath = FileUtil.copyFileToKdanPdfReaderFolder(filePath as String, copyMode)
|
|
|
insertToRecentDocumentList(filePath as String)
|
|
|
}
|
|
|
- viewModel.openPdfFile(applicationContext, uri, password, Runnable { requestPassword() }, intent.type)
|
|
|
+ viewModel.openPdfFile(applicationContext, Uri.parse(filePath), password, Runnable { requestPassword() }, intent.type)
|
|
|
}
|
|
|
setupRightToolbar()
|
|
|
viewModel.pageIndexLiveData.observe(this, Observer(this::onPageIndexChanged))
|