Skip to content

Commit

Permalink
Fixes for a few edge cases
Browse files Browse the repository at this point in the history
  • Loading branch information
harshad1 committed Nov 10, 2023
1 parent 867f930 commit 2ea9d01
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,11 @@ public static void launch(Activity activity, File path, Boolean doPreview, Inten
GsContextUtils.instance.animateToActivity(activity, intent, false, null);
}


public static void handleFileClick(Activity activity, File file, Integer lineNumber) {
if (activity != null && file != null && file.canRead()) {
if (FormatRegistry.isFileSupported(file) || file.isDirectory()) {
if (activity != null && file != null) {
final boolean readableDirectory = file.isDirectory() && file.canRead();
final boolean creatableFile = FormatRegistry.isFileSupported(file) && GsFileUtils.canCreate(file);
if (readableDirectory || creatableFile) {
launch(activity, file, null, null, lineNumber);
} else if (GsFileUtils.getFilenameExtension(file).equals(".apk")) {
GsContextUtils.instance.requestApkInstallation(activity, file);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public class FormatRegistry {
};

public static boolean isFileSupported(final File file, final boolean... textOnly) {
boolean textonly = textOnly != null && textOnly.length > 0 && textOnly[0];
final boolean textonly = textOnly != null && textOnly.length > 0 && textOnly[0];
if (file != null) {
final String filepath = file.getAbsolutePath().toLowerCase(Locale.ROOT);
for (TextConverterBase converter : CONVERTERS) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,12 @@ public void onFsViewerDoUiUpdate(GsFileBrowserListAdapter adapter) {
}
}
}

@Override
public void onFsViewerCancel(final String request) {
super.onFsViewerCancel(request);
_filesystemViewerAdapter.reloadCurrentFolder(); // May be new folders
}
}, getChildFragmentManager(), getActivity());
}

Expand Down

0 comments on commit 2ea9d01

Please sign in to comment.