properly select the files to delete

This commit is contained in:
tibbi 2017-05-14 17:15:05 +02:00
parent 74da4b454b
commit ae6b53d464
2 changed files with 2 additions and 2 deletions

View file

@ -286,7 +286,7 @@ class DirectoryAdapter(val activity: SimpleActivity, val dirs: MutableList<Direc
} }
activity.handleSAFDialog(File(needPermissionForPath)) { activity.handleSAFDialog(File(needPermissionForPath)) {
selectedPositions.reversed().forEach { selectedPositions.sortedDescending().forEach {
val directory = dirs[it] val directory = dirs[it]
folders.add(File(directory.path)) folders.add(File(directory.path))
removeFolders.add(directory) removeFolders.add(directory)

View file

@ -223,7 +223,7 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList<Medium>,
val removeMedia = ArrayList<Medium>(selectedPositions.size) val removeMedia = ArrayList<Medium>(selectedPositions.size)
activity.handleSAFDialog(File(media[selectedPositions.first()].path)) { activity.handleSAFDialog(File(media[selectedPositions.first()].path)) {
selectedPositions.reversed().forEach { selectedPositions.sortedDescending().forEach {
val medium = media[it] val medium = media[it]
files.add(File(medium.path)) files.add(File(medium.path))
removeMedia.add(medium) removeMedia.add(medium)