add handling for moving whole folders in the recycle bin
This commit is contained in:
parent
f852b69f6e
commit
59cb293d98
1 changed files with 20 additions and 0 deletions
|
@ -395,6 +395,26 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
|
|||
|
||||
override fun deleteFolders(folders: ArrayList<File>) {
|
||||
val fileDirItems = folders.map { FileDirItem(it.absolutePath, it.name, true) } as ArrayList<FileDirItem>
|
||||
if (config.useRecycleBin) {
|
||||
val pathsToDelete = ArrayList<String>()
|
||||
fileDirItems.filter { it.isDirectory }.forEach {
|
||||
val files = File(it.path).listFiles()
|
||||
files?.filter { it.absolutePath.isImageVideoGif() }?.mapTo(pathsToDelete) { it.absolutePath }
|
||||
}
|
||||
|
||||
movePathsInRecycleBin(pathsToDelete) {
|
||||
if (it) {
|
||||
deleteFilteredFolders(fileDirItems, folders)
|
||||
} else {
|
||||
toast(R.string.unknown_error_occurred)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
deleteFilteredFolders(fileDirItems, folders)
|
||||
}
|
||||
}
|
||||
|
||||
private fun deleteFilteredFolders(fileDirItems: ArrayList<FileDirItem>, folders: ArrayList<File>) {
|
||||
deleteFolders(fileDirItems) {
|
||||
runOnUiThread {
|
||||
refreshItems()
|
||||
|
|
Loading…
Reference in a new issue