|
@@ -1,17 +1,27 @@
|
|
|
package com.kdanmobile.pdfreaderviewapp
|
|
|
|
|
|
import android.content.Intent
|
|
|
+import android.os.Environment
|
|
|
import com.kdanmobile.reader.CopyFileActivity
|
|
|
import java.io.File
|
|
|
|
|
|
class MyCopyFileActivity: CopyFileActivity() {
|
|
|
- override fun provideFileName(): String {
|
|
|
- return File(intent.getStringExtra(MyReaderActivity.KEY_FILE_ABSOLUTE)).name
|
|
|
+ override fun getKdanPdfReaderFolder(): File {
|
|
|
+ val external = Environment.getExternalStorageDirectory()
|
|
|
+ val folder = File(external, "KdanPDFReader")
|
|
|
+ if (!folder.exists() || !folder.isDirectory)
|
|
|
+ folder.mkdirs()
|
|
|
+ return folder
|
|
|
}
|
|
|
|
|
|
- override fun provideReaderActivityIntent(): Intent {
|
|
|
+ override fun provideReaderActivityIntent(filePath: String?): Intent {
|
|
|
val readerIntent = Intent(this, MyReaderActivity::class.java)
|
|
|
- readerIntent.putExtra(MyReaderActivity.KEY_FILE_ABSOLUTE, intent.getStringExtra(MyReaderActivity.KEY_FILE_ABSOLUTE))
|
|
|
+ val absoluteFilePath = if (filePath.isNullOrEmpty()) {
|
|
|
+ intent.getStringExtra(MyReaderActivity.KEY_FILE_ABSOLUTE)
|
|
|
+ } else {
|
|
|
+ filePath
|
|
|
+ }
|
|
|
+ readerIntent.putExtra(MyReaderActivity.KEY_FILE_ABSOLUTE, absoluteFilePath)
|
|
|
readerIntent.putExtra("copyFile", intent.getBooleanExtra("copyFile", false))
|
|
|
return readerIntent
|
|
|
}
|