mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-22 20:48:00 +01:00
update the getSelectedMedia function
This commit is contained in:
parent
c93cfcc729
commit
c58811a8ce
2 changed files with 4 additions and 6 deletions
|
@ -193,7 +193,7 @@ class DirectoryAdapter(val activity: SimpleActivity, val dirs: MutableList<Direc
|
|||
|
||||
private fun getSelectedPaths(): HashSet<String> {
|
||||
val positions = multiSelector.selectedPositions
|
||||
val paths = HashSet<String>()
|
||||
val paths = HashSet<String>(positions.size)
|
||||
positions.forEach { paths.add(dirs[it].path) }
|
||||
return paths
|
||||
}
|
||||
|
|
|
@ -112,11 +112,9 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList<Medium>,
|
|||
}
|
||||
|
||||
private fun getSelectedMedia(): List<Medium> {
|
||||
val selections = multiSelector.selectedPositions
|
||||
val cnt = selections.size
|
||||
val selectedMedia = (0..cnt - 1)
|
||||
.map { media[selections[it]] }
|
||||
|
||||
val positions = multiSelector.selectedPositions
|
||||
val selectedMedia = ArrayList<Medium>(positions.size)
|
||||
positions.forEach { selectedMedia.add(media[it]) }
|
||||
return selectedMedia
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue