Skip to content

Commit

Permalink
fixed new task open issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Kafle committed Aug 29, 2023
1 parent 0b9601d commit 58be08e
Showing 1 changed file with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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) {
Expand All @@ -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);
Expand Down

0 comments on commit 58be08e

Please sign in to comment.