mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-30 08:18:00 +01:00
improve the hack for proper displaying of media on Android 4
This commit is contained in:
parent
d4d80b4b47
commit
5547679004
1 changed files with 9 additions and 4 deletions
|
@ -62,9 +62,12 @@ class MediaFetcher(val context: Context) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getSelectionQuery(path: String): String {
|
private fun getSelectionQuery(path: String): String? {
|
||||||
val dataQuery = "${MediaStore.Images.Media.DATA} LIKE ?"
|
val dataQuery = "${MediaStore.Images.Media.DATA} LIKE ?"
|
||||||
return if (path.isEmpty()) {
|
return if (path.isEmpty()) {
|
||||||
|
if (context.isAndroidFour())
|
||||||
|
return null
|
||||||
|
|
||||||
var query = "($dataQuery)"
|
var query = "($dataQuery)"
|
||||||
if (context.hasExternalSDCard()) {
|
if (context.hasExternalSDCard()) {
|
||||||
query += " OR ($dataQuery)"
|
query += " OR ($dataQuery)"
|
||||||
|
@ -75,13 +78,15 @@ class MediaFetcher(val context: Context) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getSelectionArgsQuery(path: String): Array<String> {
|
private fun getSelectionArgsQuery(path: String): Array<String>? {
|
||||||
return if (path.isEmpty()) {
|
return if (path.isEmpty()) {
|
||||||
|
if (context.isAndroidFour())
|
||||||
|
return null
|
||||||
|
|
||||||
if (context.hasExternalSDCard()) {
|
if (context.hasExternalSDCard()) {
|
||||||
arrayOf("${context.internalStoragePath}/%", "${context.sdCardPath}/%")
|
arrayOf("${context.internalStoragePath}/%", "${context.sdCardPath}/%")
|
||||||
} else {
|
} else {
|
||||||
val internalPath = if (context.isAndroidFour()) "" else context.internalStoragePath
|
arrayOf("${context.internalStoragePath}/%")
|
||||||
arrayOf("$internalPath/%")
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
arrayOf("$path/%", "$path/%/%")
|
arrayOf("$path/%", "$path/%/%")
|
||||||
|
|
Loading…
Reference in a new issue