mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2025-03-12 06:30:06 +01:00
ACTION_GET_CONTENT with multiple mime types
Some apps provide multiple mime types separated by either comma or pipe. Without this, image/*,video/* only shows videos.
This commit is contained in:
parent
a948355d2e
commit
ff8158c25d
1 changed files with 5 additions and 5 deletions
|
@ -599,10 +599,10 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
|
||||||
|
|
||||||
mShouldStopFetching = true
|
mShouldStopFetching = true
|
||||||
mIsGettingDirs = true
|
mIsGettingDirs = true
|
||||||
val getImagesOnly = mIsPickImageIntent || mIsGetImageContentIntent
|
val getImages = mIsPickImageIntent || mIsGetImageContentIntent
|
||||||
val getVideosOnly = mIsPickVideoIntent || mIsGetVideoContentIntent
|
val getVideos = mIsPickVideoIntent || mIsGetVideoContentIntent
|
||||||
|
|
||||||
getCachedDirectories(getVideosOnly, getImagesOnly) {
|
getCachedDirectories(getVideos && !getImages, getImages && !getVideos) {
|
||||||
gotDirectories(addTempFolderIfNeeded(it))
|
gotDirectories(addTempFolderIfNeeded(it))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -890,10 +890,10 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
|
||||||
private fun isGetContentIntent(intent: Intent) = intent.action == Intent.ACTION_GET_CONTENT && intent.type != null
|
private fun isGetContentIntent(intent: Intent) = intent.action == Intent.ACTION_GET_CONTENT && intent.type != null
|
||||||
|
|
||||||
private fun isGetImageContentIntent(intent: Intent) = isGetContentIntent(intent) &&
|
private fun isGetImageContentIntent(intent: Intent) = isGetContentIntent(intent) &&
|
||||||
(intent.type!!.startsWith("image/") || intent.type == Images.Media.CONTENT_TYPE)
|
(intent.type!!.split(",", "|").any { it.startsWith("image/") } || intent.type == Images.Media.CONTENT_TYPE)
|
||||||
|
|
||||||
private fun isGetVideoContentIntent(intent: Intent) = isGetContentIntent(intent) &&
|
private fun isGetVideoContentIntent(intent: Intent) = isGetContentIntent(intent) &&
|
||||||
(intent.type!!.startsWith("video/") || intent.type == Video.Media.CONTENT_TYPE)
|
(intent.type!!.split(",", "|").any { it.startsWith("video/") } || intent.type == Video.Media.CONTENT_TYPE)
|
||||||
|
|
||||||
private fun isGetAnyContentIntent(intent: Intent) = isGetContentIntent(intent) && intent.type == "*/*"
|
private fun isGetAnyContentIntent(intent: Intent) = isGetContentIntent(intent) && intent.type == "*/*"
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue