|
@@ -3,7 +3,6 @@ package com.kdanmobile.reader.copyfile
|
|
|
import android.arch.lifecycle.Observer
|
|
|
import android.content.Intent
|
|
|
import android.os.Bundle
|
|
|
-import android.support.v7.app.AlertDialog
|
|
|
import com.kdanmobile.base.KdanBaseActivity
|
|
|
import com.kdanmobile.reader.R
|
|
|
import com.kdanmobile.reader.thumb.FileUtil
|
|
@@ -22,7 +21,7 @@ abstract class CopyFileActivity : KdanBaseActivity() {
|
|
|
const val KEY_SHOULD_COPY_FILE = "should_copy_file"
|
|
|
}
|
|
|
|
|
|
- private var fileCannotOpenDialog: AlertDialog? = null
|
|
|
+ private var fileCannotOpenDialog: FileCannotOpenDialogFragment? = null
|
|
|
|
|
|
private val viewModel: CopyFileViewModel by viewModel {
|
|
|
val kdanPdfReaderFolder = getKdanPdfReaderFolder()
|
|
@@ -61,19 +60,11 @@ abstract class CopyFileActivity : KdanBaseActivity() {
|
|
|
}
|
|
|
|
|
|
private fun showFileCannotOpenDialog(title: String) {
|
|
|
- fileCannotOpenDialog = AlertDialog.Builder(this)
|
|
|
- .setTitle(title)
|
|
|
- .setCancelable(false)
|
|
|
- .setPositiveButton(getString(android.R.string.ok)) { dialog, which ->
|
|
|
- finish()
|
|
|
- }
|
|
|
- .create()
|
|
|
- fileCannotOpenDialog?.show()
|
|
|
- }
|
|
|
-
|
|
|
- override fun onDestroy() {
|
|
|
- fileCannotOpenDialog?.dismiss()
|
|
|
- super.onDestroy()
|
|
|
+ fileCannotOpenDialog = FileCannotOpenDialogFragment()
|
|
|
+ fileCannotOpenDialog?.arguments = Bundle().also {
|
|
|
+ it.putString(FileCannotOpenDialogFragment.KEY_DIALOG_TITLE, title)
|
|
|
+ }
|
|
|
+ fileCannotOpenDialog?.show(supportFragmentManager, fileCannotOpenDialog?.tag)
|
|
|
}
|
|
|
|
|
|
private fun startReaderActivity(filePath: String?) {
|