do not check if the folder is recycle bin at fetching files

This commit is contained in:
tibbi 2019-02-27 13:59:10 +01:00
parent e4fd4bad8d
commit 4fcd1b0fb6

View file

@ -158,7 +158,8 @@ class MediaFetcher(val context: Context) {
favoritePaths: ArrayList<String>, getVideoDurations: Boolean): ArrayList<Medium> { favoritePaths: ArrayList<String>, getVideoDurations: Boolean): ArrayList<Medium> {
val media = ArrayList<Medium>() val media = ArrayList<Medium>()
val deletedMedia = if (folder == RECYCLE_BIN) { val isRecycleBin = folder == RECYCLE_BIN
val deletedMedia = if (isRecycleBin) {
context.getUpdatedDeletedMedia(context.galleryDB.MediumDao()) context.getUpdatedDeletedMedia(context.galleryDB.MediumDao())
} else { } else {
ArrayList() ArrayList()
@ -166,7 +167,7 @@ class MediaFetcher(val context: Context) {
val doExtraCheck = context.config.doExtraCheck val doExtraCheck = context.config.doExtraCheck
val showHidden = context.config.shouldShowHidden val showHidden = context.config.shouldShowHidden
val dateTakens = if (getProperDateTaken && folder != FAVORITES && folder != RECYCLE_BIN) getFolderDateTakens(folder) else HashMap() val dateTakens = if (getProperDateTaken && folder != FAVORITES && !isRecycleBin) getFolderDateTakens(folder) else HashMap()
val files = when (folder) { val files = when (folder) {
FAVORITES -> favoritePaths.filter { showHidden || !it.contains("/.") }.map { File(it) }.toTypedArray() FAVORITES -> favoritePaths.filter { showHidden || !it.contains("/.") }.map { File(it) }.toTypedArray()
@ -212,7 +213,7 @@ class MediaFetcher(val context: Context) {
if (size <= 0L || (doExtraCheck && !file.exists())) if (size <= 0L || (doExtraCheck && !file.exists()))
continue continue
if (folder == RECYCLE_BIN) { if (isRecycleBin) {
deletedMedia.firstOrNull { it.path == path }?.apply { deletedMedia.firstOrNull { it.path == path }?.apply {
media.add(this) media.add(this)
} }