renaming cur to cursor

This commit is contained in:
tibbi 2018-04-10 19:52:23 +02:00
parent a73a61907c
commit 91f1efac31

View file

@ -42,8 +42,8 @@ class MediaFetcher(val context: Context) {
val selectionArgs = getSelectionArgsQuery(curPath, filterMedia).toTypedArray() val selectionArgs = getSelectionArgsQuery(curPath, filterMedia).toTypedArray()
return try { return try {
val cur = context.contentResolver.query(uri, projection, selection, selectionArgs, null) val cursor = context.contentResolver.query(uri, projection, selection, selectionArgs, null)
parseCursor(context, cur, isPickImage, isPickVideo, curPath, filterMedia) parseCursor(context, cursor, isPickImage, isPickVideo, curPath, filterMedia)
} catch (e: Exception) { } catch (e: Exception) {
ArrayList() ArrayList()
} }
@ -104,20 +104,20 @@ class MediaFetcher(val context: Context) {
return args return args
} }
private fun parseCursor(context: Context, cur: Cursor, isPickImage: Boolean, isPickVideo: Boolean, curPath: String, filterMedia: Int): ArrayList<Medium> { private fun parseCursor(context: Context, cursor: Cursor, isPickImage: Boolean, isPickVideo: Boolean, curPath: String, filterMedia: Int): ArrayList<Medium> {
val config = context.config val config = context.config
val includedFolders = config.includedFolders val includedFolders = config.includedFolders
val foldersToScan = HashSet<String>() val foldersToScan = HashSet<String>()
cur.use { cursor.use {
if (cur.moveToFirst()) { if (cursor.moveToFirst()) {
do { do {
val path = cur.getStringValue(MediaStore.Images.Media.DATA).trim() val path = cursor.getStringValue(MediaStore.Images.Media.DATA).trim()
val parentPath = File(path).parent.trimEnd('/') val parentPath = File(path).parent.trimEnd('/')
if (!includedFolders.contains(parentPath)) { if (!includedFolders.contains(parentPath)) {
foldersToScan.add(parentPath) foldersToScan.add(parentPath)
} }
} while (cur.moveToNext()) } while (cursor.moveToNext())
} }
} }