From c93705ebefeef5e9e6f7ff7973031f1be5346a11 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 11 Aug 2019 15:22:25 +0200 Subject: [PATCH] reordering a few lines around media fetching --- .../gallery/pro/helpers/MediaFetcher.kt | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/MediaFetcher.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/MediaFetcher.kt index 0132367b3..74bc635e9 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/MediaFetcher.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/MediaFetcher.kt @@ -38,13 +38,6 @@ class MediaFetcher(val context: Context) { } fun getFoldersToScan(): ArrayList { - val filterMedia = context.config.filterMedia - val projection = arrayOf(MediaStore.Images.Media.DATA) - val uri = MediaStore.Files.getContentUri("external") - - val selection = "${getSelectionQuery(filterMedia)} ${MediaStore.Images.ImageColumns.BUCKET_ID} IS NOT NULL) GROUP BY (${MediaStore.Images.ImageColumns.BUCKET_ID}" - val selectionArgs = getSelectionArgsQuery(filterMedia).toTypedArray() - return try { val folders = getLatestFileFolders() folders.addAll(arrayListOf( @@ -53,6 +46,11 @@ class MediaFetcher(val context: Context) { Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES).toString() ).filter { File(it).exists() }) + val filterMedia = context.config.filterMedia + val uri = MediaStore.Files.getContentUri("external") + val projection = arrayOf(MediaStore.Images.Media.DATA) + val selection = "${getSelectionQuery(filterMedia)} ${MediaStore.Images.ImageColumns.BUCKET_ID} IS NOT NULL) GROUP BY (${MediaStore.Images.ImageColumns.BUCKET_ID}" + val selectionArgs = getSelectionArgsQuery(filterMedia).toTypedArray() val cursor = context.contentResolver.query(uri, projection, selection, selectionArgs, null) folders.addAll(parseCursor(cursor))