fix some data consistency issues when fetching recycle bin items

This commit is contained in:
tibbi 2018-06-27 15:39:38 +02:00
parent ed8fa63ce8
commit e0f8d311ba
1 changed files with 23 additions and 18 deletions

View File

@ -211,6 +211,12 @@ class MediaFetcher(val context: Context) {
if (size <= 0L || (doExtraCheck && !file.exists()))
continue
val path = file.absolutePath
if (folder == RECYCLE_BIN) {
deletedMedia.firstOrNull { it.path == path }?.apply {
media.add(this)
}
} else {
val lastModified = file.lastModified()
var dateTaken = lastModified
@ -225,12 +231,11 @@ class MediaFetcher(val context: Context) {
else -> TYPE_RAWS
}
val path = file.absolutePath
val isFavorite = favoritePaths.contains(path)
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)
val medium = Medium(null, filename, path, file.parent, lastModified, dateTaken, size, type, isFavorite, 0L)
media.add(medium)
}
}
return media
}