From 5468baf5132833feade35a60e0486d697e95f093 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 22 Mar 2018 15:12:20 +0100 Subject: [PATCH] try scanning Screenshots and Downloads folders thoroughly --- .../gallery/helpers/MediaFetcher.kt | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaFetcher.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaFetcher.kt index 97a4e4114..659636d1e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaFetcher.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaFetcher.kt @@ -3,6 +3,7 @@ package com.simplemobiletools.gallery.helpers import android.content.Context import android.database.Cursor import android.net.Uri +import android.os.Environment import android.provider.MediaStore import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.commons.helpers.* @@ -200,7 +201,18 @@ class MediaFetcher(val context: Context) { } } - config.includedFolders.filter { it.isNotEmpty() && (curPath.isEmpty() || it == curPath) }.forEach { + val downloadsFolder = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).toString() + val screenshotsFolder = "${Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES)}/Screenshots" + val foldersToScan = config.includedFolders + if (File(downloadsFolder).exists()) { + foldersToScan.add(downloadsFolder) + } + + if (File(screenshotsFolder).exists()) { + foldersToScan.add(screenshotsFolder) + } + + foldersToScan.filter { it.isNotEmpty() && (curPath.isEmpty() || it == curPath) }.forEach { if (it.startsWith(OTG_PATH)) { getMediaOnOTG(it, curMedia, isPickImage, isPickVideo, filterMedia, allowRecursion) } else {