From d286ca7e41f3e7a13d2203c8e3504a276821156a Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 3 Jul 2022 09:56:35 +0200 Subject: [PATCH] get proper mimetype at Get Content intents --- .../filemanager/pro/activities/MainActivity.kt | 16 +++++++++++++--- .../pro/fragments/MyViewPagerFragment.kt | 1 + 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/MainActivity.kt index 9093ae28..6a0bd407 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/MainActivity.kt @@ -370,10 +370,20 @@ class MainActivity : SimpleActivity() { 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 { - it?.isGetRingtonePicker = intent.action == RingtoneManager.ACTION_RINGTONE_PICKER - it?.isGetContentIntent = intent.action == Intent.ACTION_GET_CONTENT - it?.isPickMultipleIntent = intent.getBooleanExtra(Intent.EXTRA_ALLOW_MULTIPLE, false) + it?.isGetRingtonePicker = isPickRingtoneIntent + it?.isPickMultipleIntent = allowPickingMultipleIntent + it?.isGetContentIntent = isGetContentIntent + it?.getContentMimeType = getContentMimeType } if (refreshRecents) { diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/MyViewPagerFragment.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/MyViewPagerFragment.kt index 290e01b1..910f6775 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/MyViewPagerFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/MyViewPagerFragment.kt @@ -19,6 +19,7 @@ abstract class MyViewPagerFragment(context: Context, attributeSet: AttributeSet) var isGetContentIntent = false var isGetRingtonePicker = false var isPickMultipleIntent = false + var getContentMimeType = "" protected fun clickedPath(path: String) { if (isGetContentIntent) {