Skip to content

Commit d286ca7

Browse files
committed
get proper mimetype at Get Content intents
1 parent 16d0b2e commit d286ca7

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/MainActivity.kt

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -370,10 +370,20 @@ class MainActivity : SimpleActivity() {
370370
openPath(config.homeFolder)
371371
}
372372

373+
val isPickRingtoneIntent = intent.action == RingtoneManager.ACTION_RINGTONE_PICKER
374+
val isGetContentIntent = intent.action == Intent.ACTION_GET_CONTENT
375+
val allowPickingMultipleIntent = intent.getBooleanExtra(Intent.EXTRA_ALLOW_MULTIPLE, false)
376+
val getContentMimeType = if (isGetContentIntent) {
377+
intent.type ?: ""
378+
} else {
379+
""
380+
}
381+
373382
getAllFragments().forEach {
374-
it?.isGetRingtonePicker = intent.action == RingtoneManager.ACTION_RINGTONE_PICKER
375-
it?.isGetContentIntent = intent.action == Intent.ACTION_GET_CONTENT
376-
it?.isPickMultipleIntent = intent.getBooleanExtra(Intent.EXTRA_ALLOW_MULTIPLE, false)
383+
it?.isGetRingtonePicker = isPickRingtoneIntent
384+
it?.isPickMultipleIntent = allowPickingMultipleIntent
385+
it?.isGetContentIntent = isGetContentIntent
386+
it?.getContentMimeType = getContentMimeType
377387
}
378388

379389
if (refreshRecents) {

app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/MyViewPagerFragment.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ abstract class MyViewPagerFragment(context: Context, attributeSet: AttributeSet)
1919
var isGetContentIntent = false
2020
var isGetRingtonePicker = false
2121
var isPickMultipleIntent = false
22+
var getContentMimeType = ""
2223

2324
protected fun clickedPath(path: String) {
2425
if (isGetContentIntent) {

0 commit comments

Comments
 (0)