fix deleting files on Android 10

This commit is contained in:
tibbi 2022-07-02 15:02:39 +02:00
parent 1c05c8a685
commit 52a38e4dc1

View File

@ -175,7 +175,13 @@ class RecordingsAdapter(
val uri = Media.getContentUri(MediaStore.VOLUME_EXTERNAL_PRIMARY)
val selection = "${Media._ID} = ?"
val selectionArgs = arrayOf(it.id.toString())
activity.contentResolver.delete(uri, selection, selectionArgs)
val result = activity.contentResolver.delete(uri, selection, selectionArgs)
if (result == 0) {
recordingsToRemove.forEach {
activity.deleteFile(File(it.path).toFileDirItem(activity))
}
}
}
doDeleteAnimation(oldRecordingIndex, recordingsToRemove, positions)
}