From 58be08e2cb29d0c057c332d0f70ebfbed2657edc Mon Sep 17 00:00:00 2001 From: Kafle Date: Tue, 29 Aug 2023 18:47:13 +0530 Subject: [PATCH 1/2] fixed new task open issue --- .../filesystem/files/FileUtils.java | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 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 d55e7f09b3..2021dfb054 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 @@ -749,7 +749,7 @@ public static void openFile( mainActivity.startActivity(intent); } else { try { - openFileDialogFragmentFor(f, mainActivity); + openFileDialogFragmentFor(f, mainActivity,useNewStack); } catch (Exception e) { Toast.makeText( mainActivity, mainActivity.getString(R.string.no_app_found), Toast.LENGTH_LONG) @@ -760,30 +760,30 @@ public static void openFile( } private static void openFileDialogFragmentFor( - @NonNull File file, @NonNull MainActivity mainActivity) { + @NonNull File file, @NonNull MainActivity mainActivity, @NonNull Boolean useNewStack) { openFileDialogFragmentFor( - file, mainActivity, MimeTypes.getMimeType(file.getAbsolutePath(), false)); + file, mainActivity, MimeTypes.getMimeType(file.getAbsolutePath(), false),useNewStack); } private static void openFileDialogFragmentFor( - @NonNull File file, @NonNull MainActivity mainActivity, @NonNull String mimeType) { + @NonNull File file, @NonNull MainActivity mainActivity, @NonNull String mimeType, @NonNull Boolean useNewStack) { OpenFileDialogFragment.Companion.openFileOrShow( FileProvider.getUriForFile(mainActivity, mainActivity.getPackageName(), file), mimeType, - false, + useNewStack, mainActivity, false); } private static void openFileDialogFragmentFor( - @NonNull DocumentFile file, @NonNull MainActivity mainActivity) { + @NonNull DocumentFile file, @NonNull MainActivity mainActivity, @NonNull Boolean useNewStack) { openFileDialogFragmentFor( - file.getUri(), mainActivity, MimeTypes.getMimeType(file.getUri().toString(), false)); + file.getUri(), mainActivity, MimeTypes.getMimeType(file.getUri().toString(), false), useNewStack); } private static void openFileDialogFragmentFor( - @NonNull Uri uri, @NonNull MainActivity mainActivity, @NonNull String mimeType) { - OpenFileDialogFragment.Companion.openFileOrShow(uri, mimeType, false, mainActivity, false); + @NonNull Uri uri, @NonNull MainActivity mainActivity, @NonNull String mimeType, @NonNull Boolean useNewStack) { + OpenFileDialogFragment.Companion.openFileOrShow(uri, mimeType, useNewStack, mainActivity, false); } private static boolean isSelfDefault(File f, Context c) { @@ -804,7 +804,7 @@ public static void openFile( boolean useNewStack = sharedPrefs.getBoolean(PreferencesConstants.PREFERENCE_TEXTEDITOR_NEWSTACK, false); try { - openFileDialogFragmentFor(f, m); + openFileDialogFragmentFor(f, m, useNewStack); } catch (Exception e) { Toast.makeText(m, m.getString(R.string.no_app_found), Toast.LENGTH_LONG).show(); openWith(f, m, useNewStack); From d2e52df9a18cf2cb4009c2c6c5969027ed0d4e96 Mon Sep 17 00:00:00 2001 From: Kafle Date: Mon, 4 Sep 2023 11:36:01 +0530 Subject: [PATCH 2/2] spotless apply --- .../filesystem/files/FileUtils.java | 26 ++++++++++++++----- 1 file changed, 19 insertions(+), 7 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 2021dfb054..cf8a2cd612 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 @@ -749,7 +749,7 @@ public static void openFile( mainActivity.startActivity(intent); } else { try { - openFileDialogFragmentFor(f, mainActivity,useNewStack); + openFileDialogFragmentFor(f, mainActivity, useNewStack); } catch (Exception e) { Toast.makeText( mainActivity, mainActivity.getString(R.string.no_app_found), Toast.LENGTH_LONG) @@ -762,11 +762,14 @@ public static void openFile( private static void openFileDialogFragmentFor( @NonNull File file, @NonNull MainActivity mainActivity, @NonNull Boolean useNewStack) { openFileDialogFragmentFor( - file, mainActivity, MimeTypes.getMimeType(file.getAbsolutePath(), false),useNewStack); + file, mainActivity, MimeTypes.getMimeType(file.getAbsolutePath(), false), useNewStack); } private static void openFileDialogFragmentFor( - @NonNull File file, @NonNull MainActivity mainActivity, @NonNull String mimeType, @NonNull Boolean useNewStack) { + @NonNull File file, + @NonNull MainActivity mainActivity, + @NonNull String mimeType, + @NonNull Boolean useNewStack) { OpenFileDialogFragment.Companion.openFileOrShow( FileProvider.getUriForFile(mainActivity, mainActivity.getPackageName(), file), mimeType, @@ -776,14 +779,23 @@ private static void openFileDialogFragmentFor( } private static void openFileDialogFragmentFor( - @NonNull DocumentFile file, @NonNull MainActivity mainActivity, @NonNull Boolean useNewStack) { + @NonNull DocumentFile file, + @NonNull MainActivity mainActivity, + @NonNull Boolean useNewStack) { openFileDialogFragmentFor( - file.getUri(), mainActivity, MimeTypes.getMimeType(file.getUri().toString(), false), useNewStack); + file.getUri(), + mainActivity, + MimeTypes.getMimeType(file.getUri().toString(), false), + useNewStack); } private static void openFileDialogFragmentFor( - @NonNull Uri uri, @NonNull MainActivity mainActivity, @NonNull String mimeType, @NonNull Boolean useNewStack) { - OpenFileDialogFragment.Companion.openFileOrShow(uri, mimeType, useNewStack, mainActivity, false); + @NonNull Uri uri, + @NonNull MainActivity mainActivity, + @NonNull String mimeType, + @NonNull Boolean useNewStack) { + OpenFileDialogFragment.Companion.openFileOrShow( + uri, mimeType, useNewStack, mainActivity, false); } private static boolean isSelfDefault(File f, Context c) {