create a list of folders that should be ignored (fake internal storage paths)
This commit is contained in:
parent
702164e719
commit
a417a20e11
|
@ -97,6 +97,7 @@ class MediaFetcher(val context: Context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun parseCursor(cursor: Cursor): ArrayList<String> {
|
private fun parseCursor(cursor: Cursor): ArrayList<String> {
|
||||||
|
val foldersToIgnore = arrayListOf("/storage/emulated/legacy")
|
||||||
val config = context.config
|
val config = context.config
|
||||||
val includedFolders = config.includedFolders
|
val includedFolders = config.includedFolders
|
||||||
var foldersToScan = ArrayList<String>()
|
var foldersToScan = ArrayList<String>()
|
||||||
|
@ -106,7 +107,7 @@ class MediaFetcher(val context: Context) {
|
||||||
do {
|
do {
|
||||||
val path = cursor.getStringValue(MediaStore.Images.Media.DATA).trim()
|
val path = cursor.getStringValue(MediaStore.Images.Media.DATA).trim()
|
||||||
val parentPath = File(path).parent?.trimEnd('/') ?: continue
|
val parentPath = File(path).parent?.trimEnd('/') ?: continue
|
||||||
if (!includedFolders.contains(parentPath)) {
|
if (!includedFolders.contains(parentPath) && !foldersToIgnore.contains(parentPath.toLowerCase())) {
|
||||||
foldersToScan.add(parentPath)
|
foldersToScan.add(parentPath)
|
||||||
}
|
}
|
||||||
} while (cursor.moveToNext())
|
} while (cursor.moveToNext())
|
||||||
|
|
Loading…
Reference in New Issue