Skip to content

Commit

Permalink
Some more small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
harshad1 committed Dec 26, 2024
1 parent d31628e commit 1980dae
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ public void onClickFab(final View view) {
return;
}

if (_notebook.getAdapter().isCurrentFolderVirtual()) {
if (!_notebook.getAdapter().isCurrentFolderWriteable()) {
_notebook.getAdapter().setCurrentFolder(_appSettings.getNotebookDirectory());
return;
}
Expand All @@ -308,10 +308,6 @@ public void onClickFab(final View view) {
return;
}

if (!_notebook.getAdapter().isCurrentFolderWriteable()) {
return;
}

NewFileDialog.newInstance(_notebook.getCurrentFolder(), true, this::newItemCallback)
.show(getSupportFragmentManager(), NewFileDialog.FRAGMENT_TAG);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ public void onFsViewerSelected(String request, File file, Integer lineNumber) {
@Override
public void onFsViewerConfig(GsFileBrowserOptions.Options dopt) {
dopt.titleText = isMove ? R.string.move : R.string.copy;
dopt.rootFolder = _appSettings.getNotebookDirectory();
dopt.rootFolder = GsFileBrowserListAdapter.VIRTUAL_STORAGE_ROOT;
dopt.startFolder = getCurrentFolder();
// Directories cannot be moved into themselves. Don't give users the option
final Set<String> selSet = new HashSet<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ public void onAttachedToRecyclerView(@NonNull final RecyclerView view) {
super.onAttachedToRecyclerView(view);
_recyclerView = view;
_layoutManager = (LinearLayoutManager) view.getLayoutManager();
loadFolder(_dopt.startFolder != null ? _dopt.startFolder : _dopt.rootFolder, null);
reloadCurrentFolder();
}

public String formatFileDescription(final File file, String format) {
Expand Down Expand Up @@ -331,13 +331,17 @@ public void restoreSavedInstanceState(final Bundle savedInstanceState) {
}

public void reloadCurrentFolder() {
loadFolder(_currentFolder != null ? _currentFolder : _dopt.rootFolder, null);
if (_currentFolder != null) {
loadFolder(_currentFolder, null);
} else if (_dopt.startFolder != null) {
loadFolder(_dopt.startFolder, null);
} else {
loadFolder(_dopt.rootFolder, null);
}
}

public void setCurrentFolder(final File folder) {
if (folder != null && !folder.equals(_currentFolder)) {
loadFolder(folder, GsFileUtils.isChild(_currentFolder, folder) ? folder : null);
}
loadFolder(folder, GsFileUtils.isChild(_currentFolder, folder) ? folder : null);
}

public boolean isCurrentFolderVirtual() {
Expand Down

0 comments on commit 1980dae

Please sign in to comment.