removing a redundant parameter

This commit is contained in:
tibbi 2020-02-12 17:12:10 +01:00
parent 4dfa4c9ea8
commit 57e77abde0
2 changed files with 5 additions and 7 deletions

View file

@ -891,7 +891,6 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
val albumCovers = config.parseAlbumCovers() val albumCovers = config.parseAlbumCovers()
val includedFolders = config.includedFolders val includedFolders = config.includedFolders
val tempFolderPath = config.tempFolderPath val tempFolderPath = config.tempFolderPath
val isSortingAscending = config.directorySorting and SORT_DESCENDING == 0
val getProperFileSize = config.directorySorting and SORT_BY_SIZE != 0 val getProperFileSize = config.directorySorting and SORT_BY_SIZE != 0
val favoritePaths = getFavoritePaths() val favoritePaths = getFavoritePaths()
val dirPathsToRemove = ArrayList<String>() val dirPathsToRemove = ArrayList<String>()
@ -921,7 +920,7 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
} }
directory directory
} else { } else {
createDirectoryFromMedia(directory.path, curMedia, albumCovers, hiddenString, includedFolders, isSortingAscending, getProperFileSize) createDirectoryFromMedia(directory.path, curMedia, albumCovers, hiddenString, includedFolders, getProperFileSize)
} }
// we are looping through the already displayed folders looking for changes, do not do anything if nothing changed // we are looping through the already displayed folders looking for changes, do not do anything if nothing changed
@ -1014,7 +1013,7 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
} }
} }
val newDir = createDirectoryFromMedia(folder, newMedia, albumCovers, hiddenString, includedFolders, isSortingAscending, getProperFileSize) val newDir = createDirectoryFromMedia(folder, newMedia, albumCovers, hiddenString, includedFolders, getProperFileSize)
dirs.add(newDir) dirs.add(newDir)
setupAdapter(dirs) setupAdapter(dirs)
try { try {

View file

@ -857,11 +857,10 @@ fun Context.addPathToDB(path: String) {
} }
fun Context.createDirectoryFromMedia(path: String, curMedia: ArrayList<Medium>, albumCovers: ArrayList<AlbumCover>, hiddenString: String, fun Context.createDirectoryFromMedia(path: String, curMedia: ArrayList<Medium>, albumCovers: ArrayList<AlbumCover>, hiddenString: String,
includedFolders: MutableSet<String>, isSortingAscending: Boolean, getProperFileSize: Boolean): Directory { includedFolders: MutableSet<String>, getProperFileSize: Boolean): Directory {
val OTGPath = config.OTGPath val OTGPath = config.OTGPath
val grouped = MediaFetcher(this).groupMedia(curMedia, path) val grouped = MediaFetcher(this).groupMedia(curMedia, path)
val sortedMedia = grouped.filter { it is Medium }.toMutableList() as ArrayList<Medium> val sortedMedia = grouped.filter { it is Medium }.toMutableList() as ArrayList<Medium>
var thumbnail = sortedMedia.firstOrNull { getDoesFilePathExist(it.path, OTGPath) }?.path ?: "" var thumbnail = sortedMedia.firstOrNull { getDoesFilePathExist(it.path, OTGPath) }?.path ?: ""
albumCovers.forEach { albumCovers.forEach {
@ -874,6 +873,7 @@ fun Context.createDirectoryFromMedia(path: String, curMedia: ArrayList<Medium>,
thumbnail = thumbnail.getOTGPublicPath(applicationContext) thumbnail = thumbnail.getOTGPublicPath(applicationContext)
} }
val isSortingAscending = config.directorySorting.isSortingAscending()
val defaultMedium = Medium(0, "", "", "", 0L, 0L, 0L, 0, 0, false, 0L) val defaultMedium = Medium(0, "", "", "", 0L, 0L, 0L, 0, 0, false, 0L)
val firstItem = curMedia.firstOrNull() ?: defaultMedium val firstItem = curMedia.firstOrNull() ?: defaultMedium
val lastItem = curMedia.lastOrNull() ?: defaultMedium val lastItem = curMedia.lastOrNull() ?: defaultMedium
@ -919,7 +919,6 @@ fun Context.updateDirectoryPath(path: String) {
val hiddenString = getString(R.string.hidden) val hiddenString = getString(R.string.hidden)
val albumCovers = config.parseAlbumCovers() val albumCovers = config.parseAlbumCovers()
val includedFolders = config.includedFolders val includedFolders = config.includedFolders
val isSortingAscending = config.directorySorting.isSortingAscending()
val sorting = config.getFileSorting(path) val sorting = config.getFileSorting(path)
val grouping = config.getFolderGrouping(path) val grouping = config.getFolderGrouping(path)
@ -936,7 +935,7 @@ fun Context.updateDirectoryPath(path: String) {
val getProperFileSize = config.directorySorting and SORT_BY_SIZE != 0 val getProperFileSize = config.directorySorting and SORT_BY_SIZE != 0
val favoritePaths = getFavoritePaths() val favoritePaths = getFavoritePaths()
val curMedia = mediaFetcher.getFilesFrom(path, getImagesOnly, getVideosOnly, getProperDateTaken, getProperLastModified, getProperFileSize, favoritePaths, false) val curMedia = mediaFetcher.getFilesFrom(path, getImagesOnly, getVideosOnly, getProperDateTaken, getProperLastModified, getProperFileSize, favoritePaths, false)
val directory = createDirectoryFromMedia(path, curMedia, albumCovers, hiddenString, includedFolders, isSortingAscending, getProperFileSize) val directory = createDirectoryFromMedia(path, curMedia, albumCovers, hiddenString, includedFolders, getProperFileSize)
updateDBDirectory(directory) updateDBDirectory(directory)
} }