diff --git a/app/src/main/java/sushi/hardcore/droidfs/explorers/BaseExplorerActivity.kt b/app/src/main/java/sushi/hardcore/droidfs/explorers/BaseExplorerActivity.kt index 368eb29..79cff64 100644 --- a/app/src/main/java/sushi/hardcore/droidfs/explorers/BaseExplorerActivity.kt +++ b/app/src/main/java/sushi/hardcore/droidfs/explorers/BaseExplorerActivity.kt @@ -327,6 +327,13 @@ open class BaseExplorerActivity : BaseActivity() { .setTitle(R.string.enter_new_name) .setPositiveButton(R.string.ok) { _, _ -> items[i].dstPath = PathUtils.pathJoin(dstDirectoryPath, PathUtils.getRelativePath(srcDirectoryPath, items[i].explorerElement.parentPath), dialogEditText.text.toString()) + if (items[i].explorerElement.isDirectory){ + for (j in 0 until items.size){ + if (PathUtils.isChildOf(items[j].explorerElement.fullPath, items[i].explorerElement.fullPath)){ + items[j].dstPath = PathUtils.pathJoin(items[i].dstPath!!, PathUtils.getRelativePath(items[i].explorerElement.fullPath, items[j].explorerElement.fullPath)) + } + } + } checkPathOverwrite(items, dstDirectoryPath, callback) } .setOnCancelListener{ diff --git a/app/src/main/java/sushi/hardcore/droidfs/explorers/ExplorerActivity.kt b/app/src/main/java/sushi/hardcore/droidfs/explorers/ExplorerActivity.kt index 9b4a17a..4b899ee 100644 --- a/app/src/main/java/sushi/hardcore/droidfs/explorers/ExplorerActivity.kt +++ b/app/src/main/java/sushi/hardcore/droidfs/explorers/ExplorerActivity.kt @@ -185,6 +185,7 @@ class ExplorerActivity : BaseExplorerActivity() { .setPositiveButton(R.string.ok, null) .show() } + setCurrentPath(currentDirectoryPath) } } } else if (requestCode == PICK_DIRECTORY_REQUEST_CODE) { @@ -260,6 +261,7 @@ class ExplorerActivity : BaseExplorerActivity() { .setPositiveButton(R.string.ok, null) .show() } + setCurrentPath(currentDirectoryPath) } remoteGocryptfsVolume.close() } @@ -351,6 +353,7 @@ class ExplorerActivity : BaseExplorerActivity() { } else { Toast.makeText(this, R.string.copy_success, Toast.LENGTH_SHORT).show() } + setCurrentPath(currentDirectoryPath) } } } @@ -372,6 +375,7 @@ class ExplorerActivity : BaseExplorerActivity() { } else { Toast.makeText(this, R.string.move_success, Toast.LENGTH_SHORT).show() } + setCurrentPath(currentDirectoryPath) } } } diff --git a/app/src/main/java/sushi/hardcore/droidfs/explorers/ExplorerActivityDrop.kt b/app/src/main/java/sushi/hardcore/droidfs/explorers/ExplorerActivityDrop.kt index 2574854..233c05b 100644 --- a/app/src/main/java/sushi/hardcore/droidfs/explorers/ExplorerActivityDrop.kt +++ b/app/src/main/java/sushi/hardcore/droidfs/explorers/ExplorerActivityDrop.kt @@ -67,6 +67,7 @@ class ExplorerActivityDrop : BaseExplorerActivity() { } private fun onImported(failedItem: String?){ + setCurrentPath(currentDirectoryPath) if (failedItem == null) { ColoredAlertDialogBuilder(this) .setTitle(R.string.success_import) diff --git a/app/src/main/java/sushi/hardcore/droidfs/util/PathUtils.kt b/app/src/main/java/sushi/hardcore/droidfs/util/PathUtils.kt index 0266c50..0faac4c 100644 --- a/app/src/main/java/sushi/hardcore/droidfs/util/PathUtils.kt +++ b/app/src/main/java/sushi/hardcore/droidfs/util/PathUtils.kt @@ -56,6 +56,13 @@ object PathUtils { } } + fun isChildOf(childPath: String, parentPath: String): Boolean { + if (parentPath.length > childPath.length){ + return false + } + return childPath.substring(0, parentPath.length) == parentPath + } + fun getFilenameFromURI(context: Context, uri: Uri): String? { var result: String? = null if (uri.scheme == "content") {