From 580cd1f75ad74797f844ac6f5109096f62c256d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ensar=20Saraj=C4=8Di=C4=87?= Date: Fri, 21 Jul 2023 16:24:11 +0200 Subject: [PATCH] Set intent data into fragments before starting them This ensures that fragments have all data needed before doing initial data loading. This will ensure that Recents tab properly filters files by mime type immediately, instead of only after doing a pull to refresh. --- .../filemanager/pro/activities/MainActivity.kt | 18 ------------------ .../pro/adapters/ViewPagerAdapter.kt | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+), 18 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 b8ce7e3f..eb4a3261 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 @@ -373,24 +373,6 @@ class MainActivity : SimpleActivity() { 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) { recents_fragment?.refreshFragment() } diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/adapters/ViewPagerAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/adapters/ViewPagerAdapter.kt index 7aad2f83..dab82eb4 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/adapters/ViewPagerAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/adapters/ViewPagerAdapter.kt @@ -1,5 +1,7 @@ package com.simplemobiletools.filemanager.pro.adapters +import android.content.Intent +import android.media.RingtoneManager import android.view.View import android.view.ViewGroup import androidx.viewpager.widget.PagerAdapter @@ -19,6 +21,22 @@ class ViewPagerAdapter(val activity: SimpleActivity, val tabsToShow: ArrayList