optimize folder fetching a bit

This commit is contained in:
tibbi 2019-02-27 18:52:54 +01:00
parent 60b6af17f8
commit 1daa85e629

View file

@ -125,9 +125,9 @@ class MediaFetcher(val context: Context) {
cursor.use { cursor.use {
if (cursor.moveToFirst()) { if (cursor.moveToFirst()) {
do { do {
val path = cursor.getStringValue(MediaStore.Images.Media.DATA).trim() val path = cursor.getStringValue(MediaStore.Images.Media.DATA)
val parentPath = File(path).parent?.trimEnd('/') ?: continue val parentPath = File(path).parent?.trimEnd('/') ?: continue
if (!includedFolders.contains(parentPath) && !foldersToIgnore.contains(parentPath.toLowerCase())) { if (!includedFolders.contains(parentPath) && !foldersToIgnore.contains(parentPath)) {
foldersToScan.add(parentPath) foldersToScan.add(parentPath)
} }
} while (cursor.moveToNext()) } while (cursor.moveToNext())