update the getSelectedMedia function

This commit is contained in:
tibbi 2016-11-19 21:01:31 +01:00
parent c93cfcc729
commit c58811a8ce
2 changed files with 4 additions and 6 deletions

View file

@ -193,7 +193,7 @@ class DirectoryAdapter(val activity: SimpleActivity, val dirs: MutableList<Direc
private fun getSelectedPaths(): HashSet<String> { private fun getSelectedPaths(): HashSet<String> {
val positions = multiSelector.selectedPositions val positions = multiSelector.selectedPositions
val paths = HashSet<String>() val paths = HashSet<String>(positions.size)
positions.forEach { paths.add(dirs[it].path) } positions.forEach { paths.add(dirs[it].path) }
return paths return paths
} }

View file

@ -112,11 +112,9 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList<Medium>,
} }
private fun getSelectedMedia(): List<Medium> { private fun getSelectedMedia(): List<Medium> {
val selections = multiSelector.selectedPositions val positions = multiSelector.selectedPositions
val cnt = selections.size val selectedMedia = ArrayList<Medium>(positions.size)
val selectedMedia = (0..cnt - 1) positions.forEach { selectedMedia.add(media[it]) }
.map { media[selections[it]] }
return selectedMedia return selectedMedia
} }