mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-26 22:47:59 +01:00
get MediaStore last modified values in more cases, not just on R+
This commit is contained in:
parent
a77580df50
commit
e86e6986c0
4 changed files with 9 additions and 13 deletions
|
@ -936,7 +936,7 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
|
||||||
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 dirPathsToRemove = ArrayList<String>()
|
val dirPathsToRemove = ArrayList<String>()
|
||||||
val lastModifieds = if (isRPlus()) mLastMediaFetcher!!.getLastModifieds() else HashMap()
|
val lastModifieds = mLastMediaFetcher!!.getLastModifieds()
|
||||||
val dateTakens = mLastMediaFetcher!!.getDateTakens()
|
val dateTakens = mLastMediaFetcher!!.getDateTakens()
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -30,7 +30,7 @@ class GetMediaAsynctask(val context: Context, val mPath: String, val isPickImage
|
||||||
val getProperFileSize = fileSorting and SORT_BY_SIZE != 0
|
val getProperFileSize = fileSorting and SORT_BY_SIZE != 0
|
||||||
val favoritePaths = context.getFavoritePaths()
|
val favoritePaths = context.getFavoritePaths()
|
||||||
val getVideoDurations = context.config.showThumbnailVideoDuration
|
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 dateTakens = if (getProperDateTaken) mediaFetcher.getDateTakens() else HashMap()
|
||||||
|
|
||||||
val media = if (showAll) {
|
val media = if (showAll) {
|
||||||
|
|
|
@ -931,7 +931,7 @@ fun Context.updateDirectoryPath(path: String) {
|
||||||
|
|
||||||
val getProperFileSize = config.directorySorting and SORT_BY_SIZE != 0
|
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 dateTakens = mediaFetcher.getFolderDateTakens(path)
|
||||||
val favoritePaths = getFavoritePaths()
|
val favoritePaths = getFavoritePaths()
|
||||||
val curMedia = mediaFetcher.getFilesFrom(path, getImagesOnly, getVideosOnly, getProperDateTaken, getProperLastModified, getProperFileSize,
|
val curMedia = mediaFetcher.getFilesFrom(path, getImagesOnly, getVideosOnly, getProperDateTaken, getProperLastModified, getProperFileSize,
|
||||||
|
|
|
@ -321,15 +321,11 @@ class MediaFetcher(val context: Context) {
|
||||||
} else {
|
} else {
|
||||||
var lastModified = 0L
|
var lastModified = 0L
|
||||||
if (getProperLastModified) {
|
if (getProperLastModified) {
|
||||||
if (isRPlus()) {
|
var newLastModified = lastModifieds.remove(path)
|
||||||
var newLastModified = lastModifieds.remove(path)
|
if (newLastModified == null) {
|
||||||
if (newLastModified == null) {
|
newLastModified = file.lastModified()
|
||||||
newLastModified = file.lastModified()
|
|
||||||
}
|
|
||||||
lastModified = newLastModified
|
|
||||||
} else {
|
|
||||||
lastModified = file.lastModified()
|
|
||||||
}
|
}
|
||||||
|
lastModified = newLastModified
|
||||||
}
|
}
|
||||||
|
|
||||||
var dateTaken = lastModified
|
var dateTaken = lastModified
|
||||||
|
@ -590,7 +586,7 @@ class MediaFetcher(val context: Context) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
media.sortWith(Comparator { o1, o2 ->
|
media.sortWith { o1, o2 ->
|
||||||
o1 as Medium
|
o1 as Medium
|
||||||
o2 as Medium
|
o2 as Medium
|
||||||
var result = when {
|
var result = when {
|
||||||
|
@ -617,7 +613,7 @@ class MediaFetcher(val context: Context) {
|
||||||
result *= -1
|
result *= -1
|
||||||
}
|
}
|
||||||
result
|
result
|
||||||
})
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun groupMedia(media: ArrayList<Medium>, path: String): ArrayList<ThumbnailItem> {
|
fun groupMedia(media: ArrayList<Medium>, path: String): ArrayList<ThumbnailItem> {
|
||||||
|
|
Loading…
Reference in a new issue