mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-23 13:08:00 +01:00
make sure we get the proper thumbnail at file grouping too
This commit is contained in:
parent
8a26a6c272
commit
4dfa4c9ea8
2 changed files with 39 additions and 7 deletions
|
@ -902,8 +902,17 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
val getProperDateTaken = config.directorySorting and SORT_BY_DATE_TAKEN != 0 || config.getFileSorting(directory.path) and SORT_BY_DATE_TAKEN != 0
|
val sorting = config.getFileSorting(directory.path)
|
||||||
val getProperLastModified = config.directorySorting and SORT_BY_DATE_MODIFIED != 0 || config.getFileSorting(directory.path) and SORT_BY_DATE_MODIFIED != 0
|
val grouping = config.getFolderGrouping(directory.path)
|
||||||
|
val getProperDateTaken = config.directorySorting and SORT_BY_DATE_TAKEN != 0 ||
|
||||||
|
sorting and SORT_BY_DATE_TAKEN != 0 ||
|
||||||
|
grouping and GROUP_BY_DATE_TAKEN_DAILY != 0 ||
|
||||||
|
grouping and GROUP_BY_DATE_TAKEN_MONTHLY != 0
|
||||||
|
|
||||||
|
val getProperLastModified = config.directorySorting and SORT_BY_DATE_MODIFIED != 0 ||
|
||||||
|
sorting and SORT_BY_DATE_MODIFIED != 0 ||
|
||||||
|
grouping and GROUP_BY_LAST_MODIFIED_DAILY != 0 ||
|
||||||
|
grouping and GROUP_BY_LAST_MODIFIED_MONTHLY != 0
|
||||||
|
|
||||||
val curMedia = mLastMediaFetcher!!.getFilesFrom(directory.path, getImagesOnly, getVideosOnly, getProperDateTaken, getProperLastModified, getProperFileSize, favoritePaths, false)
|
val curMedia = mLastMediaFetcher!!.getFilesFrom(directory.path, getImagesOnly, getVideosOnly, getProperDateTaken, getProperLastModified, getProperFileSize, favoritePaths, false)
|
||||||
val newDir = if (curMedia.isEmpty()) {
|
val newDir = if (curMedia.isEmpty()) {
|
||||||
|
@ -979,8 +988,17 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
val getProperDateTaken = config.directorySorting and SORT_BY_DATE_TAKEN != 0 || config.getFileSorting(folder) and SORT_BY_DATE_TAKEN != 0
|
val sorting = config.getFileSorting(folder)
|
||||||
val getProperLastModified = config.directorySorting and SORT_BY_DATE_MODIFIED != 0 || config.getFileSorting(folder) and SORT_BY_DATE_MODIFIED != 0
|
val grouping = config.getFolderGrouping(folder)
|
||||||
|
val getProperDateTaken = config.directorySorting and SORT_BY_DATE_TAKEN != 0 ||
|
||||||
|
sorting and SORT_BY_DATE_TAKEN != 0 ||
|
||||||
|
grouping and GROUP_BY_DATE_TAKEN_DAILY != 0 ||
|
||||||
|
grouping and GROUP_BY_DATE_TAKEN_MONTHLY != 0
|
||||||
|
|
||||||
|
val getProperLastModified = config.directorySorting and SORT_BY_DATE_MODIFIED != 0 ||
|
||||||
|
sorting and SORT_BY_DATE_MODIFIED != 0 ||
|
||||||
|
grouping and GROUP_BY_LAST_MODIFIED_DAILY != 0 ||
|
||||||
|
grouping and GROUP_BY_LAST_MODIFIED_MONTHLY != 0
|
||||||
|
|
||||||
val newMedia = mLastMediaFetcher!!.getFilesFrom(folder, getImagesOnly, getVideosOnly, getProperDateTaken, getProperLastModified, getProperFileSize, favoritePaths, false)
|
val newMedia = mLastMediaFetcher!!.getFilesFrom(folder, getImagesOnly, getVideosOnly, getProperDateTaken, getProperLastModified, getProperFileSize, favoritePaths, false)
|
||||||
if (newMedia.isEmpty()) {
|
if (newMedia.isEmpty()) {
|
||||||
|
|
|
@ -859,7 +859,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>, isSortingAscending: Boolean, getProperFileSize: Boolean): Directory {
|
||||||
val OTGPath = config.OTGPath
|
val OTGPath = config.OTGPath
|
||||||
var thumbnail = curMedia.firstOrNull { getDoesFilePathExist(it.path, OTGPath) }?.path ?: ""
|
val grouped = MediaFetcher(this).groupMedia(curMedia, path)
|
||||||
|
val sortedMedia = grouped.filter { it is Medium }.toMutableList() as ArrayList<Medium>
|
||||||
|
|
||||||
|
var thumbnail = sortedMedia.firstOrNull { getDoesFilePathExist(it.path, OTGPath) }?.path ?: ""
|
||||||
|
|
||||||
albumCovers.forEach {
|
albumCovers.forEach {
|
||||||
if (it.path == path && getDoesFilePathExist(it.tmb, OTGPath)) {
|
if (it.path == path && getDoesFilePathExist(it.tmb, OTGPath)) {
|
||||||
|
@ -917,8 +920,19 @@ fun Context.updateDirectoryPath(path: String) {
|
||||||
val albumCovers = config.parseAlbumCovers()
|
val albumCovers = config.parseAlbumCovers()
|
||||||
val includedFolders = config.includedFolders
|
val includedFolders = config.includedFolders
|
||||||
val isSortingAscending = config.directorySorting.isSortingAscending()
|
val isSortingAscending = config.directorySorting.isSortingAscending()
|
||||||
val getProperDateTaken = config.directorySorting and SORT_BY_DATE_TAKEN != 0
|
|
||||||
val getProperLastModified = config.directorySorting and SORT_BY_DATE_MODIFIED != 0
|
val sorting = config.getFileSorting(path)
|
||||||
|
val grouping = config.getFolderGrouping(path)
|
||||||
|
val getProperDateTaken = config.directorySorting and SORT_BY_DATE_TAKEN != 0 ||
|
||||||
|
sorting and SORT_BY_DATE_TAKEN != 0 ||
|
||||||
|
grouping and GROUP_BY_DATE_TAKEN_DAILY != 0 ||
|
||||||
|
grouping and GROUP_BY_DATE_TAKEN_MONTHLY != 0
|
||||||
|
|
||||||
|
val getProperLastModified = config.directorySorting and SORT_BY_DATE_MODIFIED != 0 ||
|
||||||
|
sorting and SORT_BY_DATE_MODIFIED != 0 ||
|
||||||
|
grouping and GROUP_BY_LAST_MODIFIED_DAILY != 0 ||
|
||||||
|
grouping and GROUP_BY_LAST_MODIFIED_MONTHLY != 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 curMedia = mediaFetcher.getFilesFrom(path, getImagesOnly, getVideosOnly, getProperDateTaken, getProperLastModified, getProperFileSize, favoritePaths, false)
|
val curMedia = mediaFetcher.getFilesFrom(path, getImagesOnly, getVideosOnly, getProperDateTaken, getProperLastModified, getProperFileSize, favoritePaths, false)
|
||||||
|
|
Loading…
Reference in a new issue