mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-26 22:47:59 +01:00
fetch proper deletedTS at items in the recycle bin
This commit is contained in:
parent
b7b49f579e
commit
11fde4daa0
1 changed files with 9 additions and 2 deletions
|
@ -162,9 +162,15 @@ class MediaFetcher(val context: Context) {
|
||||||
favoritePaths: ArrayList<String>): ArrayList<Medium> {
|
favoritePaths: ArrayList<String>): ArrayList<Medium> {
|
||||||
val media = ArrayList<Medium>()
|
val media = ArrayList<Medium>()
|
||||||
|
|
||||||
|
val deletedMedia = if (folder == RECYCLE_BIN) {
|
||||||
|
context.getUpdatedDeletedMedia(context.galleryDB.MediumDao())
|
||||||
|
} else {
|
||||||
|
ArrayList()
|
||||||
|
}
|
||||||
|
|
||||||
val files = when (folder) {
|
val files = when (folder) {
|
||||||
FAVORITES -> favoritePaths.map { File(it) }.toTypedArray()
|
FAVORITES -> favoritePaths.map { File(it) }.toTypedArray()
|
||||||
RECYCLE_BIN -> context.getUpdatedDeletedMedia(context.galleryDB.MediumDao()).map { File(it.path) }.toTypedArray()
|
RECYCLE_BIN -> deletedMedia.map { File(it.path) }.toTypedArray()
|
||||||
else -> File(folder).listFiles() ?: return media
|
else -> File(folder).listFiles() ?: return media
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -221,7 +227,8 @@ class MediaFetcher(val context: Context) {
|
||||||
|
|
||||||
val path = file.absolutePath
|
val path = file.absolutePath
|
||||||
val isFavorite = favoritePaths.contains(path)
|
val isFavorite = favoritePaths.contains(path)
|
||||||
val medium = Medium(null, filename, path, file.parent, lastModified, dateTaken, size, type, isFavorite, 0L)
|
val deletedTS = if (folder == RECYCLE_BIN) deletedMedia.firstOrNull { it.path == path }?.deletedTS ?: 0L else 0L
|
||||||
|
val medium = Medium(null, filename, path, file.parent, lastModified, dateTaken, size, type, isFavorite, deletedTS)
|
||||||
media.add(medium)
|
media.add(medium)
|
||||||
}
|
}
|
||||||
return media
|
return media
|
||||||
|
|
Loading…
Reference in a new issue