get proper mimetype at Get Content intents

This commit is contained in:
tibbi
2022-07-03 09:56:35 +02:00
parent 16d0b2e9e5
commit d286ca7e41
2 changed files with 14 additions and 3 deletions

View File

@ -370,10 +370,20 @@ class MainActivity : SimpleActivity() {
openPath(config.homeFolder) openPath(config.homeFolder)
} }
val isPickRingtoneIntent = intent.action == RingtoneManager.ACTION_RINGTONE_PICKER
val isGetContentIntent = intent.action == Intent.ACTION_GET_CONTENT
val allowPickingMultipleIntent = intent.getBooleanExtra(Intent.EXTRA_ALLOW_MULTIPLE, false)
val getContentMimeType = if (isGetContentIntent) {
intent.type ?: ""
} else {
""
}
getAllFragments().forEach { getAllFragments().forEach {
it?.isGetRingtonePicker = intent.action == RingtoneManager.ACTION_RINGTONE_PICKER it?.isGetRingtonePicker = isPickRingtoneIntent
it?.isGetContentIntent = intent.action == Intent.ACTION_GET_CONTENT it?.isPickMultipleIntent = allowPickingMultipleIntent
it?.isPickMultipleIntent = intent.getBooleanExtra(Intent.EXTRA_ALLOW_MULTIPLE, false) it?.isGetContentIntent = isGetContentIntent
it?.getContentMimeType = getContentMimeType
} }
if (refreshRecents) { if (refreshRecents) {

View File

@ -19,6 +19,7 @@ abstract class MyViewPagerFragment(context: Context, attributeSet: AttributeSet)
var isGetContentIntent = false var isGetContentIntent = false
var isGetRingtonePicker = false var isGetRingtonePicker = false
var isPickMultipleIntent = false var isPickMultipleIntent = false
var getContentMimeType = ""
protected fun clickedPath(path: String) { protected fun clickedPath(path: String) {
if (isGetContentIntent) { if (isGetContentIntent) {