check SD card permissions also if moving files from SD card

This commit is contained in:
tibbi 2016-12-08 19:02:35 +01:00
parent 7879d6b6ea
commit 06e1796902

View file

@ -59,8 +59,7 @@ class CopyDialog(val activity: SimpleActivity, val files: ArrayList<File>, val c
} }
if (files.size == 1) { if (files.size == 1) {
val newFile = File(files[0].path) if (File(destinationPath, files[0].name).exists()) {
if (File(destinationPath, newFile.name).exists()) {
context.toast(R.string.already_exists) context.toast(R.string.already_exists)
return@setOnClickListener return@setOnClickListener
} }
@ -78,6 +77,10 @@ class CopyDialog(val activity: SimpleActivity, val files: ArrayList<File>, val c
dismiss() dismiss()
} else { } else {
if (context.isPathOnSD(sourcePath) || context.isPathOnSD(destinationPath)) { if (context.isPathOnSD(sourcePath) || context.isPathOnSD(destinationPath)) {
if (activity.isShowingPermDialog(files[0])) {
return@setOnClickListener
}
context.toast(R.string.moving) context.toast(R.string.moving)
val pair = Pair<ArrayList<File>, File>(files, destinationDir) val pair = Pair<ArrayList<File>, File>(files, destinationDir)
CopyMoveTask(context, true, config.treeUri, true, copyMoveListener).execute(pair) CopyMoveTask(context, true, config.treeUri, true, copyMoveListener).execute(pair)