File Operations: refresh on done & fix bug

This commit is contained in:
Matéo Duparc 2020-12-29 19:10:07 +01:00
parent f00901a717
commit 0f4d2b057b
Signed by untrusted user: hardcoresushi
GPG Key ID: 007F84120107191E
4 changed files with 19 additions and 0 deletions

View File

@ -327,6 +327,13 @@ open class BaseExplorerActivity : BaseActivity() {
.setTitle(R.string.enter_new_name) .setTitle(R.string.enter_new_name)
.setPositiveButton(R.string.ok) { _, _ -> .setPositiveButton(R.string.ok) { _, _ ->
items[i].dstPath = PathUtils.pathJoin(dstDirectoryPath, PathUtils.getRelativePath(srcDirectoryPath, items[i].explorerElement.parentPath), dialogEditText.text.toString()) 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) checkPathOverwrite(items, dstDirectoryPath, callback)
} }
.setOnCancelListener{ .setOnCancelListener{

View File

@ -185,6 +185,7 @@ class ExplorerActivity : BaseExplorerActivity() {
.setPositiveButton(R.string.ok, null) .setPositiveButton(R.string.ok, null)
.show() .show()
} }
setCurrentPath(currentDirectoryPath)
} }
} }
} else if (requestCode == PICK_DIRECTORY_REQUEST_CODE) { } else if (requestCode == PICK_DIRECTORY_REQUEST_CODE) {
@ -260,6 +261,7 @@ class ExplorerActivity : BaseExplorerActivity() {
.setPositiveButton(R.string.ok, null) .setPositiveButton(R.string.ok, null)
.show() .show()
} }
setCurrentPath(currentDirectoryPath)
} }
remoteGocryptfsVolume.close() remoteGocryptfsVolume.close()
} }
@ -351,6 +353,7 @@ class ExplorerActivity : BaseExplorerActivity() {
} else { } else {
Toast.makeText(this, R.string.copy_success, Toast.LENGTH_SHORT).show() Toast.makeText(this, R.string.copy_success, Toast.LENGTH_SHORT).show()
} }
setCurrentPath(currentDirectoryPath)
} }
} }
} }
@ -372,6 +375,7 @@ class ExplorerActivity : BaseExplorerActivity() {
} else { } else {
Toast.makeText(this, R.string.move_success, Toast.LENGTH_SHORT).show() Toast.makeText(this, R.string.move_success, Toast.LENGTH_SHORT).show()
} }
setCurrentPath(currentDirectoryPath)
} }
} }
} }

View File

@ -67,6 +67,7 @@ class ExplorerActivityDrop : BaseExplorerActivity() {
} }
private fun onImported(failedItem: String?){ private fun onImported(failedItem: String?){
setCurrentPath(currentDirectoryPath)
if (failedItem == null) { if (failedItem == null) {
ColoredAlertDialogBuilder(this) ColoredAlertDialogBuilder(this)
.setTitle(R.string.success_import) .setTitle(R.string.success_import)

View File

@ -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? { fun getFilenameFromURI(context: Context, uri: Uri): String? {
var result: String? = null var result: String? = null
if (uri.scheme == "content") { if (uri.scheme == "content") {