Skip to content

Commit

Permalink
filemanager: Always load latest fav/recent/popular files when browsin…
Browse files Browse the repository at this point in the history
…g to it,

instead of loading from cache

by @gsantner
closes #1478
  • Loading branch information
gsantner committed Nov 4, 2021
1 parent 3d9540e commit d02b9a0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,10 @@ public void onFsViewerConfig(FilesystemViewerData.Options dopt) {
dopt.mountedStorageFolder = _shareUtil.getStorageAccessFolder();
dopt.showDotFiles = _appSettings.isShowDotFiles();
dopt.fileComparable = FilesystemViewerFragment.sortFolder(null);

dopt.favouriteFiles = _appSettings.getFavouriteFiles();
dopt.recentFiles = _appSettings.getAsFileList(_appSettings.getRecentDocuments());
dopt.popularFiles = _appSettings.getAsFileList(_appSettings.getPopularDocuments());
}

@Override
Expand All @@ -401,10 +405,6 @@ public void onFsViewerDoUiUpdate(FilesystemViewerAdapter adapter) {
_appSettings.setFileBrowserLastBrowsedFolder(adapter.getCurrentFolder());
_toolbar.setTitle(adapter.areItemsSelected() ? "" : getFileBrowserTitle());
invalidateOptionsMenu();

if (adapter.getCurrentFolder().equals(FilesystemViewerAdapter.VIRTUAL_STORAGE_FAVOURITE)) {
adapter.getFsOptions().favouriteFiles = _appSettings.getFavouriteFiles();
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,13 +233,16 @@ public void restoreSavedInstanceState(Bundle savedInstanceStateArg) {
f = new File(savedInstanceState.getString(EXTRA_CURRENT_FOLDER));
s = f.getAbsolutePath();

boolean ok = f.isDirectory()
|| _virtualMapping.containsKey(new File(savedInstanceState.getString(EXTRA_CURRENT_FOLDER)))
final boolean isVirtualDirectory = _virtualMapping.containsKey(new File(savedInstanceState.getString(EXTRA_CURRENT_FOLDER)))
|| VIRTUAL_STORAGE_APP_DATA_PRIVATE.getAbsolutePath().equals(s)
|| VIRTUAL_STORAGE_POPULAR.getAbsolutePath().equals(s)
|| VIRTUAL_STORAGE_RECENTS.getAbsolutePath().equals(s)
|| VIRTUAL_STORAGE_FAVOURITE.getAbsolutePath().equals(s);
if (ok) {

if (isVirtualDirectory && _dopt != null && _dopt.listener != null) {
_dopt.listener.onFsViewerConfig(_dopt);
}
if (f.isDirectory() || isVirtualDirectory) {
loadFolder(f);
}
}
Expand Down

0 comments on commit d02b9a0

Please sign in to comment.