reordering a few lines around media fetching
This commit is contained in:
parent
82aa3e4bd7
commit
c93705ebef
|
@ -38,13 +38,6 @@ class MediaFetcher(val context: Context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getFoldersToScan(): ArrayList<String> {
|
fun getFoldersToScan(): ArrayList<String> {
|
||||||
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 {
|
return try {
|
||||||
val folders = getLatestFileFolders()
|
val folders = getLatestFileFolders()
|
||||||
folders.addAll(arrayListOf(
|
folders.addAll(arrayListOf(
|
||||||
|
@ -53,6 +46,11 @@ class MediaFetcher(val context: Context) {
|
||||||
Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES).toString()
|
Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES).toString()
|
||||||
).filter { File(it).exists() })
|
).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)
|
val cursor = context.contentResolver.query(uri, projection, selection, selectionArgs, null)
|
||||||
folders.addAll(parseCursor(cursor))
|
folders.addAll(parseCursor(cursor))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue