From 0b1deb2578a0cd22d4272641a21cb8be9fd29ff4 Mon Sep 17 00:00:00 2001 From: VishnuSanal Date: Sat, 1 Jul 2023 17:09:13 +0530 Subject: [PATCH 1/4] fixes #3874 Signed-off-by: VishnuSanal --- .../adapters/AppsRecyclerAdapter.kt | 1 + .../filesystem/files/FileUtils.java | 10 ++++++ .../ui/dialogs/OpenFileDialogFragment.kt | 32 +++++++++++++++++++ 3 files changed, 43 insertions(+) diff --git a/app/src/main/java/com/amaze/filemanager/adapters/AppsRecyclerAdapter.kt b/app/src/main/java/com/amaze/filemanager/adapters/AppsRecyclerAdapter.kt index fa18dc62db..6b37f1017a 100644 --- a/app/src/main/java/com/amaze/filemanager/adapters/AppsRecyclerAdapter.kt +++ b/app/src/main/java/com/amaze/filemanager/adapters/AppsRecyclerAdapter.kt @@ -254,6 +254,7 @@ class AppsRecyclerAdapter( ) { uri, mimeType, useNewStack -> val intent = buildIntent( + fragment.requireContext(), uri, mimeType, useNewStack, diff --git a/app/src/main/java/com/amaze/filemanager/filesystem/files/FileUtils.java b/app/src/main/java/com/amaze/filemanager/filesystem/files/FileUtils.java index d55e7f09b3..3f9340c4d0 100644 --- a/app/src/main/java/com/amaze/filemanager/filesystem/files/FileUtils.java +++ b/app/src/main/java/com/amaze/filemanager/filesystem/files/FileUtils.java @@ -584,6 +584,16 @@ public static void openWith( break; } try { + for (ResolveInfo resolveInfo : + activity + .getPackageManager() + .queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY)) + activity.grantUriPermission( + resolveInfo.activityInfo.packageName, + uri, + Intent.FLAG_GRANT_WRITE_URI_PERMISSION + | Intent.FLAG_GRANT_READ_URI_PERMISSION); + if (intent != null) { activity.startActivity(intent); } else { diff --git a/app/src/main/java/com/amaze/filemanager/ui/dialogs/OpenFileDialogFragment.kt b/app/src/main/java/com/amaze/filemanager/ui/dialogs/OpenFileDialogFragment.kt index 9d9a68ac37..7ca01309a1 100644 --- a/app/src/main/java/com/amaze/filemanager/ui/dialogs/OpenFileDialogFragment.kt +++ b/app/src/main/java/com/amaze/filemanager/ui/dialogs/OpenFileDialogFragment.kt @@ -141,6 +141,7 @@ class OpenFileDialogFragment : BaseBottomSheetFragment(), AdjustListViewForTv= Build.VERSION_CODES.LOLLIPOP) { chooserIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT) @@ -187,12 +200,28 @@ class OpenFileDialogFragment : BaseBottomSheetFragment(), AdjustListViewForTv Date: Thu, 3 Aug 2023 19:43:19 +0530 Subject: [PATCH 2/4] fixes #3874 Signed-off-by: VishnuSanal --- .../filemanager/filesystem/files/FileUtils.java | 10 ---------- .../ui/dialogs/OpenFileDialogFragment.kt | 15 --------------- 2 files changed, 25 deletions(-) diff --git a/app/src/main/java/com/amaze/filemanager/filesystem/files/FileUtils.java b/app/src/main/java/com/amaze/filemanager/filesystem/files/FileUtils.java index 3f9340c4d0..d55e7f09b3 100644 --- a/app/src/main/java/com/amaze/filemanager/filesystem/files/FileUtils.java +++ b/app/src/main/java/com/amaze/filemanager/filesystem/files/FileUtils.java @@ -584,16 +584,6 @@ public static void openWith( break; } try { - for (ResolveInfo resolveInfo : - activity - .getPackageManager() - .queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY)) - activity.grantUriPermission( - resolveInfo.activityInfo.packageName, - uri, - Intent.FLAG_GRANT_WRITE_URI_PERMISSION - | Intent.FLAG_GRANT_READ_URI_PERMISSION); - if (intent != null) { activity.startActivity(intent); } else { diff --git a/app/src/main/java/com/amaze/filemanager/ui/dialogs/OpenFileDialogFragment.kt b/app/src/main/java/com/amaze/filemanager/ui/dialogs/OpenFileDialogFragment.kt index 7ca01309a1..e0b5746617 100644 --- a/app/src/main/java/com/amaze/filemanager/ui/dialogs/OpenFileDialogFragment.kt +++ b/app/src/main/java/com/amaze/filemanager/ui/dialogs/OpenFileDialogFragment.kt @@ -207,21 +207,6 @@ class OpenFileDialogFragment : BaseBottomSheetFragment(), AdjustListViewForTv Date: Fri, 4 Aug 2023 12:47:03 +0530 Subject: [PATCH 3/4] =?UTF-8?q?chore:=20spotless=20(manual=20=F0=9F=98=AD)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: VishnuSanal --- .../filemanager/ui/dialogs/OpenFileDialogFragment.kt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/com/amaze/filemanager/ui/dialogs/OpenFileDialogFragment.kt b/app/src/main/java/com/amaze/filemanager/ui/dialogs/OpenFileDialogFragment.kt index e0b5746617..3ed10fbd4d 100644 --- a/app/src/main/java/com/amaze/filemanager/ui/dialogs/OpenFileDialogFragment.kt +++ b/app/src/main/java/com/amaze/filemanager/ui/dialogs/OpenFileDialogFragment.kt @@ -159,11 +159,11 @@ class OpenFileDialogFragment : BaseBottomSheetFragment(), AdjustListViewForTv= Build.VERSION_CODES.LOLLIPOP) { From 489087a533bdfac42c5a0ea21976a211997f19a3 Mon Sep 17 00:00:00 2001 From: VishnuSanal Date: Fri, 4 Aug 2023 12:50:27 +0530 Subject: [PATCH 4/4] =?UTF-8?q?chore:=20spotless=20(again!=20=F0=9F=98=AD)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: VishnuSanal --- .../filemanager/ui/dialogs/OpenFileDialogFragment.kt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/com/amaze/filemanager/ui/dialogs/OpenFileDialogFragment.kt b/app/src/main/java/com/amaze/filemanager/ui/dialogs/OpenFileDialogFragment.kt index 3ed10fbd4d..e0b5746617 100644 --- a/app/src/main/java/com/amaze/filemanager/ui/dialogs/OpenFileDialogFragment.kt +++ b/app/src/main/java/com/amaze/filemanager/ui/dialogs/OpenFileDialogFragment.kt @@ -159,11 +159,11 @@ class OpenFileDialogFragment : BaseBottomSheetFragment(), AdjustListViewForTv= Build.VERSION_CODES.LOLLIPOP) {