Merge pull request #727 from esensar/fix/recents-mime-type
Set intent data into fragments before starting them
This commit is contained in:
commit
0aa0094e2c
|
@ -373,24 +373,6 @@ 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 || intent.action == Intent.ACTION_PICK
|
|
||||||
val isCreateDocumentIntent = intent.action == Intent.ACTION_CREATE_DOCUMENT
|
|
||||||
val allowPickingMultipleIntent = intent.getBooleanExtra(Intent.EXTRA_ALLOW_MULTIPLE, false)
|
|
||||||
val getContentMimeType = if (isGetContentIntent) {
|
|
||||||
intent.type ?: ""
|
|
||||||
} else {
|
|
||||||
""
|
|
||||||
}
|
|
||||||
|
|
||||||
getAllFragments().forEach {
|
|
||||||
it?.isGetRingtonePicker = isPickRingtoneIntent
|
|
||||||
it?.isPickMultipleIntent = allowPickingMultipleIntent
|
|
||||||
it?.isGetContentIntent = isGetContentIntent
|
|
||||||
it?.wantedMimeType = getContentMimeType
|
|
||||||
it?.updateIsCreateDocumentIntent(isCreateDocumentIntent)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (refreshRecents) {
|
if (refreshRecents) {
|
||||||
recents_fragment?.refreshFragment()
|
recents_fragment?.refreshFragment()
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package com.simplemobiletools.filemanager.pro.adapters
|
package com.simplemobiletools.filemanager.pro.adapters
|
||||||
|
|
||||||
|
import android.content.Intent
|
||||||
|
import android.media.RingtoneManager
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import androidx.viewpager.widget.PagerAdapter
|
import androidx.viewpager.widget.PagerAdapter
|
||||||
|
@ -19,6 +21,22 @@ class ViewPagerAdapter(val activity: SimpleActivity, val tabsToShow: ArrayList<I
|
||||||
container.addView(view)
|
container.addView(view)
|
||||||
|
|
||||||
(view as MyViewPagerFragment).apply {
|
(view as MyViewPagerFragment).apply {
|
||||||
|
val isPickRingtoneIntent = activity.intent.action == RingtoneManager.ACTION_RINGTONE_PICKER
|
||||||
|
val isGetContentIntent = activity.intent.action == Intent.ACTION_GET_CONTENT || activity.intent.action == Intent.ACTION_PICK
|
||||||
|
val isCreateDocumentIntent = activity.intent.action == Intent.ACTION_CREATE_DOCUMENT
|
||||||
|
val allowPickingMultipleIntent = activity.intent.getBooleanExtra(Intent.EXTRA_ALLOW_MULTIPLE, false)
|
||||||
|
val getContentMimeType = if (isGetContentIntent) {
|
||||||
|
activity.intent.type ?: ""
|
||||||
|
} else {
|
||||||
|
""
|
||||||
|
}
|
||||||
|
|
||||||
|
this.isGetRingtonePicker = isPickRingtoneIntent
|
||||||
|
this.isPickMultipleIntent = allowPickingMultipleIntent
|
||||||
|
this.isGetContentIntent = isGetContentIntent
|
||||||
|
this.wantedMimeType = getContentMimeType
|
||||||
|
this.updateIsCreateDocumentIntent(isCreateDocumentIntent)
|
||||||
|
|
||||||
setupFragment(activity)
|
setupFragment(activity)
|
||||||
onResume(activity.getProperTextColor())
|
onResume(activity.getProperTextColor())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue