use a copy of Dirs arraylist before updating the directories adapter
This commit is contained in:
parent
67a71efab4
commit
54f7b18e03
1 changed files with 3 additions and 3 deletions
|
@ -928,15 +928,15 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun showSortedDirs(dirs: ArrayList<Directory>) {
|
private fun showSortedDirs(dirs: ArrayList<Directory>) {
|
||||||
val updatedDirs = getUniqueSortedDirs(dirs)
|
val updatedDirs = getUniqueSortedDirs(dirs).toMutableList() as ArrayList
|
||||||
runOnUiThread {
|
runOnUiThread {
|
||||||
(directories_grid.adapter as? DirectoryAdapter)?.updateDirs(updatedDirs)
|
(directories_grid.adapter as? DirectoryAdapter)?.updateDirs(updatedDirs)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getUniqueSortedDirs(dirs: ArrayList<Directory>): ArrayList<Directory> {
|
private fun getUniqueSortedDirs(dirs: ArrayList<Directory>): ArrayList<Directory> {
|
||||||
val sortedDirs = dirs.distinctBy { it.path.getDistinctPath() } as ArrayList<Directory>
|
val distinctDirs = dirs.distinctBy { it.path.getDistinctPath() } as ArrayList<Directory>
|
||||||
return getSortedDirectories(sortedDirs)
|
return getSortedDirectories(distinctDirs)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun createDirectoryFromMedia(path: String, curMedia: ArrayList<Medium>, albumCovers: ArrayList<AlbumCover>, hiddenString: String,
|
private fun createDirectoryFromMedia(path: String, curMedia: ArrayList<Medium>, albumCovers: ArrayList<AlbumCover>, hiddenString: String,
|
||||||
|
|
Loading…
Reference in a new issue