-
Notifications
You must be signed in to change notification settings - Fork 373
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multi user file browsing, closes #2479 #2482
Conversation
} else if (VIRTUAL_STORAGE_RECENTS.equals(displayFile)) { | ||
holder.image.setImageResource(R.drawable.ic_history_black_24dp); | ||
} else { | ||
holder.image.setImageResource(isFile ? _dopt.fileImage : _dopt.folderImage); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the specific images for these folders
@@ -529,15 +554,13 @@ public boolean canGoBack() { | |||
|
|||
public boolean goUp() { | |||
if (_currentFolder != null && canGoUp()) { | |||
if (_reverseVirtualMapping.containsKey(_currentFolder)) { | |||
loadFolder(VIRTUAL_STORAGE_ROOT, _reverseVirtualMapping.get(_currentFolder)); | |||
final File parent = _currentFolder.getParentFile(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Go up to parent even if listed as a virtual folder in root
@@ -81,9 +81,8 @@ public static GsFileBrowserOptions.Options prepareFsViewerOpts( | |||
opts.favouriteFiles = appSettings.getFavouriteFiles(); | |||
opts.recentFiles = appSettings.getRecentFiles(); | |||
opts.popularFiles = appSettings.getPopularFiles(); | |||
opts.storageMaps.clear(); | |||
opts.storageMaps.put(new File("/storage", cu.rstr(context, R.string.notebook)), appSettings.getNotebookDirectory()); | |||
opts.storageMaps.put(new File("/storage/Download"), new File("/storage/emulated/0/Download")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Download folder resolved using API now
@@ -235,7 +235,7 @@ private void updateMenuItems() { | |||
// Check if is a favourite | |||
boolean selTextFilesOnly = true; | |||
boolean selDirectoriesOnly = true; | |||
boolean selWritable = (!curFilepath.equals("/storage") && !curFilepath.equals("/storage/emulated")); | |||
boolean selWritable = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't hardcode these like this now
@@ -679,27 +707,28 @@ private void loadFolder(final File folder, final File show) { | |||
final File toShow = show == null ? _fileToShowAfterNextLoad : show; | |||
_fileToShowAfterNextLoad = null; | |||
|
|||
_currentFolder = folder; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We set this early and in the wrapping sync function. Prevents bugs from preventing this from being set.
if (_hlEditor != null) { | ||
_hlEditor.toggleCase(); | ||
} | ||
TextViewUtils.toggleSelectionCase(_hlEditor.getText()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cleanups to how these are structured and organized
}; | ||
opts.refresh.callback(); | ||
// These should be refreshed in onFsViewerConfig | ||
opts.sortFolderFirst = appSettings.isFileBrowserSortFolderFirst(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These don't really need to be refreshed dynamically
final String filename = displayFile.getName(); | ||
final String currentFolderName = _currentFolder != null ? _currentFolder.getName() : ""; | ||
final File currentFolderParent = _currentFolder != null ? _currentFolder.getParentFile() : null; | ||
final File file = GsCollectionUtils.getOrDefault(_virtualMapping, displayFile, displayFile); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All of this is identical but cleaned up
// This function is not called on the main thread, so post to the UI thread | ||
private synchronized void _loadFolder(final @NonNull File folder, final @Nullable File toShow) { | ||
// This function is not called on the main thread | ||
private synchronized void _loadFolder(final boolean folderChanged, final @Nullable File toShow) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We set _currentFolder early and just use that. Prevents some bugs
I think this is good to go. But I will wait for feedback and more testing. |
Thanks, merged |
Supporting multiple users and adding a number of fixes
This addresses #2479