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 b58652a18..ea356969d 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 @@ -892,8 +892,6 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener { val includedFolders = config.includedFolders val tempFolderPath = config.tempFolderPath val isSortingAscending = config.directorySorting and SORT_DESCENDING == 0 - val getProperDateTaken = config.directorySorting and SORT_BY_DATE_TAKEN != 0 - var getProperLastModified = config.directorySorting and SORT_BY_DATE_MODIFIED != 0 val getProperFileSize = config.directorySorting and SORT_BY_SIZE != 0 val favoritePaths = getFavoritePaths() val dirPathsToRemove = ArrayList() @@ -904,9 +902,8 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener { return } - if (!getProperLastModified) { - getProperLastModified = config.getFileSorting(directory.path) and SORT_BY_DATE_MODIFIED != 0 - } + val getProperDateTaken = config.directorySorting and SORT_BY_DATE_TAKEN != 0 || config.getFileSorting(directory.path) and SORT_BY_DATE_TAKEN != 0 + val getProperLastModified = config.directorySorting and SORT_BY_DATE_MODIFIED != 0 || config.getFileSorting(directory.path) and SORT_BY_DATE_MODIFIED != 0 val curMedia = mLastMediaFetcher!!.getFilesFrom(directory.path, getImagesOnly, getVideosOnly, getProperDateTaken, getProperLastModified, getProperFileSize, favoritePaths, false) val newDir = if (curMedia.isEmpty()) { @@ -982,9 +979,8 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener { return } - if (!getProperLastModified) { - getProperLastModified = config.getFileSorting(folder) and SORT_BY_DATE_MODIFIED != 0 - } + val getProperDateTaken = config.directorySorting and SORT_BY_DATE_TAKEN != 0 || config.getFileSorting(folder) and SORT_BY_DATE_TAKEN != 0 + val getProperLastModified = config.directorySorting and SORT_BY_DATE_MODIFIED != 0 || config.getFileSorting(folder) and SORT_BY_DATE_MODIFIED != 0 val newMedia = mLastMediaFetcher!!.getFilesFrom(folder, getImagesOnly, getVideosOnly, getProperDateTaken, getProperLastModified, getProperFileSize, favoritePaths, false) if (newMedia.isEmpty()) {