lets use the new way of checking file lastmodified on Android 11+ only

This commit is contained in:
tibbi 2020-09-22 23:04:19 +02:00
parent 78a46712a8
commit 662efb3207

View file

@ -220,7 +220,7 @@ class MediaFetcher(val context: Context) {
val showHidden = config.shouldShowHidden val showHidden = config.shouldShowHidden
val showPortraits = filterMedia and TYPE_PORTRAITS != 0 val showPortraits = filterMedia and TYPE_PORTRAITS != 0
val dateTakens = if (getProperDateTaken && !isRecycleBin) getFolderDateTakens(folder) else HashMap() val dateTakens = if (getProperDateTaken && !isRecycleBin) getFolderDateTakens(folder) else HashMap()
val lastModifieds = if (getProperLastModified && !isRecycleBin) getFolderLastModifieds(folder) else HashMap() val lastModifieds = if (getProperLastModified && !isRecycleBin && isRPlus()) getFolderLastModifieds(folder) else HashMap()
val fileSizes = if (checkProperFileSize || checkFileExistence) getFolderSizes(folder) else HashMap() val fileSizes = if (checkProperFileSize || checkFileExistence) getFolderSizes(folder) else HashMap()
val files = when (folder) { val files = when (folder) {
@ -302,11 +302,15 @@ class MediaFetcher(val context: Context) {
} else { } else {
var lastModified = 0L var lastModified = 0L
if (getProperLastModified) { if (getProperLastModified) {
var newLastModified = lastModifieds.remove(path) if (isRPlus()) {
if (newLastModified == null) { var newLastModified = lastModifieds.remove(path)
newLastModified = file.lastModified() if (newLastModified == null) {
newLastModified = file.lastModified()
}
lastModified = newLastModified
} else {
lastModified = file.lastModified()
} }
lastModified = newLastModified
} }
var dateTaken = lastModified var dateTaken = lastModified