From 57e77abde057925f3943bc22dca6f87e898e6227 Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 12 Feb 2020 17:12:10 +0100 Subject: [PATCH] removing a redundant parameter --- .../gallery/pro/activities/MainActivity.kt | 5 ++--- .../simplemobiletools/gallery/pro/extensions/Context.kt | 7 +++---- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt index 895d99ebf..997c8413d 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt @@ -891,7 +891,6 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener { val albumCovers = config.parseAlbumCovers() val includedFolders = config.includedFolders val tempFolderPath = config.tempFolderPath - val isSortingAscending = config.directorySorting and SORT_DESCENDING == 0 val getProperFileSize = config.directorySorting and SORT_BY_SIZE != 0 val favoritePaths = getFavoritePaths() val dirPathsToRemove = ArrayList() @@ -921,7 +920,7 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener { } directory } 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 @@ -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) setupAdapter(dirs) try { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Context.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Context.kt index 39f71e0d7..b2f2136c9 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Context.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Context.kt @@ -857,11 +857,10 @@ fun Context.addPathToDB(path: String) { } fun Context.createDirectoryFromMedia(path: String, curMedia: ArrayList, albumCovers: ArrayList, hiddenString: String, - includedFolders: MutableSet, isSortingAscending: Boolean, getProperFileSize: Boolean): Directory { + includedFolders: MutableSet, getProperFileSize: Boolean): Directory { val OTGPath = config.OTGPath val grouped = MediaFetcher(this).groupMedia(curMedia, path) val sortedMedia = grouped.filter { it is Medium }.toMutableList() as ArrayList - var thumbnail = sortedMedia.firstOrNull { getDoesFilePathExist(it.path, OTGPath) }?.path ?: "" albumCovers.forEach { @@ -874,6 +873,7 @@ fun Context.createDirectoryFromMedia(path: String, curMedia: ArrayList, thumbnail = thumbnail.getOTGPublicPath(applicationContext) } + val isSortingAscending = config.directorySorting.isSortingAscending() val defaultMedium = Medium(0, "", "", "", 0L, 0L, 0L, 0, 0, false, 0L) val firstItem = curMedia.firstOrNull() ?: defaultMedium val lastItem = curMedia.lastOrNull() ?: defaultMedium @@ -919,7 +919,6 @@ fun Context.updateDirectoryPath(path: String) { val hiddenString = getString(R.string.hidden) val albumCovers = config.parseAlbumCovers() val includedFolders = config.includedFolders - val isSortingAscending = config.directorySorting.isSortingAscending() val sorting = config.getFileSorting(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 favoritePaths = getFavoritePaths() 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) }