get MediaStore last modified values in more cases, not just on R+

This commit is contained in:
tibbi 2021-01-14 11:03:24 +01:00
parent a77580df50
commit e86e6986c0
4 changed files with 9 additions and 13 deletions

View file

@ -936,7 +936,7 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
val getProperFileSize = config.directorySorting and SORT_BY_SIZE != 0
val favoritePaths = getFavoritePaths()
val dirPathsToRemove = ArrayList<String>()
val lastModifieds = if (isRPlus()) mLastMediaFetcher!!.getLastModifieds() else HashMap()
val lastModifieds = mLastMediaFetcher!!.getLastModifieds()
val dateTakens = mLastMediaFetcher!!.getDateTakens()
try {

View file

@ -30,7 +30,7 @@ class GetMediaAsynctask(val context: Context, val mPath: String, val isPickImage
val getProperFileSize = fileSorting and SORT_BY_SIZE != 0
val favoritePaths = context.getFavoritePaths()
val getVideoDurations = context.config.showThumbnailVideoDuration
val lastModifieds = if (isRPlus() && getProperLastModified) mediaFetcher.getLastModifieds() else HashMap()
val lastModifieds = if (getProperLastModified) mediaFetcher.getLastModifieds() else HashMap()
val dateTakens = if (getProperDateTaken) mediaFetcher.getDateTakens() else HashMap()
val media = if (showAll) {

View file

@ -931,7 +931,7 @@ fun Context.updateDirectoryPath(path: String) {
val getProperFileSize = config.directorySorting and SORT_BY_SIZE != 0
val lastModifieds = if (isRPlus() && getProperLastModified) mediaFetcher.getFolderLastModifieds(path) else HashMap()
val lastModifieds = if (getProperLastModified) mediaFetcher.getFolderLastModifieds(path) else HashMap()
val dateTakens = mediaFetcher.getFolderDateTakens(path)
val favoritePaths = getFavoritePaths()
val curMedia = mediaFetcher.getFilesFrom(path, getImagesOnly, getVideosOnly, getProperDateTaken, getProperLastModified, getProperFileSize,

View file

@ -321,15 +321,11 @@ class MediaFetcher(val context: Context) {
} else {
var lastModified = 0L
if (getProperLastModified) {
if (isRPlus()) {
var newLastModified = lastModifieds.remove(path)
if (newLastModified == null) {
newLastModified = file.lastModified()
}
lastModified = newLastModified
} else {
lastModified = file.lastModified()
var newLastModified = lastModifieds.remove(path)
if (newLastModified == null) {
newLastModified = file.lastModified()
}
lastModified = newLastModified
}
var dateTaken = lastModified
@ -590,7 +586,7 @@ class MediaFetcher(val context: Context) {
return
}
media.sortWith(Comparator { o1, o2 ->
media.sortWith { o1, o2 ->
o1 as Medium
o2 as Medium
var result = when {
@ -617,7 +613,7 @@ class MediaFetcher(val context: Context) {
result *= -1
}
result
})
}
}
fun groupMedia(media: ArrayList<Medium>, path: String): ArrayList<ThumbnailItem> {