remove another redundant function for getting unique directories

This commit is contained in:
tibbi 2018-12-13 16:34:41 +01:00
parent a0798bcd29
commit 32012061a6

View file

@ -962,11 +962,6 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
} }
} }
private fun getUniqueSortedDirs(dirs: ArrayList<Directory>): ArrayList<Directory> {
val distinctDirs = dirs.distinctBy { it.path.getDistinctPath() } as ArrayList<Directory>
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,
includedFolders: MutableSet<String>, isSortingAscending: Boolean): Directory { includedFolders: MutableSet<String>, isSortingAscending: Boolean): Directory {
var thumbnail = curMedia.firstOrNull { getDoesFilePathExist(it.path) }?.path ?: "" var thumbnail = curMedia.firstOrNull { getDoesFilePathExist(it.path) }?.path ?: ""
@ -997,8 +992,10 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
private fun setupAdapter(dirs: ArrayList<Directory>, textToSearch: String = "") { private fun setupAdapter(dirs: ArrayList<Directory>, textToSearch: String = "") {
val currAdapter = directories_grid.adapter val currAdapter = directories_grid.adapter
val updatedDirs = getUniqueSortedDirs(dirs).toMutableList() as ArrayList val distinctDirs = dirs.distinctBy { it.path.getDistinctPath() }.toMutableList() as ArrayList<Directory>
var dirsToShow = getDirsToShow(updatedDirs).clone() as ArrayList<Directory> val sortedDirs = getSortedDirectories(distinctDirs)
var dirsToShow = getDirsToShow(sortedDirs).clone() as ArrayList<Directory>
if (currAdapter == null) { if (currAdapter == null) {
initZoomListener() initZoomListener()
val fastscroller = if (config.scrollHorizontally) directories_horizontal_fastscroller else directories_vertical_fastscroller val fastscroller = if (config.scrollHorizontally) directories_horizontal_fastscroller else directories_vertical_fastscroller