mirror of
https://github.com/Myzel394/Alibi.git
synced 2025-06-19 07:15:25 +02:00
fix: Improve queries
This commit is contained in:
parent
4681a1d924
commit
61a63eeabb
@ -274,13 +274,11 @@ abstract class BatchesFolder(
|
|||||||
|
|
||||||
BatchType.MEDIA -> {
|
BatchType.MEDIA -> {
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||||
queryMediaContent { _, _, uri, _ ->
|
context.contentResolver.delete(
|
||||||
context.contentResolver.delete(
|
scopedMediaContentUri,
|
||||||
uri,
|
"${MediaStore.MediaColumns.DISPLAY_NAME} LIKE '$mediaPrefix%'",
|
||||||
null,
|
null,
|
||||||
null,
|
)
|
||||||
)
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
legacyMediaFolder.deleteRecursively()
|
legacyMediaFolder.deleteRecursively()
|
||||||
}
|
}
|
||||||
@ -299,9 +297,16 @@ abstract class BatchesFolder(
|
|||||||
var hasRecordings = false
|
var hasRecordings = false
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||||
queryMediaContent { _, _, _, _ ->
|
context.contentResolver.query(
|
||||||
hasRecordings = true
|
scopedMediaContentUri,
|
||||||
return@queryMediaContent true
|
arrayOf(MediaStore.MediaColumns.DISPLAY_NAME),
|
||||||
|
"${MediaStore.MediaColumns.DISPLAY_NAME} LIKE '$mediaPrefix%'",
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
)!!.use { cursor ->
|
||||||
|
if (cursor.moveToFirst()) {
|
||||||
|
hasRecordings = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return hasRecordings
|
return hasRecordings
|
||||||
@ -358,7 +363,7 @@ abstract class BatchesFolder(
|
|||||||
return when (type) {
|
return when (type) {
|
||||||
BatchType.INTERNAL -> true
|
BatchType.INTERNAL -> true
|
||||||
BatchType.CUSTOM -> getCustomDefinedFolder().canWrite() && getCustomDefinedFolder().canRead()
|
BatchType.CUSTOM -> getCustomDefinedFolder().canWrite() && getCustomDefinedFolder().canRead()
|
||||||
// Add support for < Android 10
|
// TODO: Add support for < Android 10
|
||||||
BatchType.MEDIA -> true
|
BatchType.MEDIA -> true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user