diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt index 96b8e14de..4c8e9d42d 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt @@ -8,6 +8,7 @@ import com.simplemobiletools.filepicker.extensions.scanFiles import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.extensions.getHumanizedFilename import com.simplemobiletools.gallery.extensions.getLongValue +import com.simplemobiletools.gallery.extensions.getStringValue import com.simplemobiletools.gallery.helpers.Config import com.simplemobiletools.gallery.helpers.SORT_BY_NAME import com.simplemobiletools.gallery.helpers.SORT_DESCENDING @@ -46,9 +47,8 @@ class GetDirectoriesAsynctask(val context: Context, val isPickVideo: Boolean, va cursor = context.contentResolver.query(uri, columns, null, null, order) if (cursor?.moveToFirst() == true) { - val pathIndex = cursor.getColumnIndex(MediaStore.Images.Media.DATA) do { - val fullPath = cursor.getString(pathIndex) ?: continue + val fullPath = cursor.getStringValue(MediaStore.Images.Media.DATA) ?: continue val file = File(fullPath) val size = cursor.getLongValue(MediaStore.Images.Media.SIZE) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetMediaAsynctask.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetMediaAsynctask.kt index 3e865e14f..424c7740a 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetMediaAsynctask.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetMediaAsynctask.kt @@ -46,9 +46,8 @@ class GetMediaAsynctask(val context: Context, val mPath: String, val isPickVideo cursor = context.contentResolver.query(uri, columns, where, args, null) if (cursor?.moveToFirst() == true) { - val pathIndex = cursor.getColumnIndex(MediaStore.Images.Media.DATA) do { - val curPath = cursor.getString(pathIndex) ?: continue + val curPath = cursor.getStringValue(MediaStore.Images.Media.DATA) ?: continue if (!mToBeDeleted.contains(curPath)) { val file = File(curPath) val size = cursor.getLongValue(MediaStore.Images.Media.SIZE)