mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-26 22:47:59 +01:00
prioritize some folders at getFoldersToScan
This commit is contained in:
parent
4b23e17cb1
commit
b9322d3dd6
1 changed files with 15 additions and 1 deletions
|
@ -2,6 +2,7 @@ package com.simplemobiletools.gallery.pro.helpers
|
|||
|
||||
import android.content.Context
|
||||
import android.database.Cursor
|
||||
import android.os.Environment
|
||||
import android.provider.MediaStore
|
||||
import android.text.format.DateFormat
|
||||
import com.simplemobiletools.commons.extensions.*
|
||||
|
@ -45,7 +46,20 @@ class MediaFetcher(val context: Context) {
|
|||
|
||||
return try {
|
||||
val cursor = context.contentResolver.query(uri, projection, selection, selectionArgs, null)
|
||||
parseCursor(cursor)
|
||||
val folders = parseCursor(cursor)
|
||||
|
||||
val priorityFolders = arrayListOf(
|
||||
Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM).toString(),
|
||||
"${Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM)}/Camera",
|
||||
Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES).toString()
|
||||
).filter { File(it).exists() }
|
||||
|
||||
folders.sortBy {
|
||||
val folder = it
|
||||
!priorityFolders.any { it.equals(folder, true) }
|
||||
}
|
||||
|
||||
folders
|
||||
} catch (e: Exception) {
|
||||
ArrayList()
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue