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..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); + openFileDialogFragmentFor(f, mainActivity, useNewStack); } catch (Exception e) { Toast.makeText( mainActivity, mainActivity.getString(R.string.no_app_found), Toast.LENGTH_LONG) @@ -760,30 +760,42 @@ 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 +816,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);