use of com.amaze.filemanager.ui.fragments.preference_fragments.PreferencesConstants.PREFERENCE_SHOW_HIDDENFILES in project AmazeFileManager by TeamAmaze.
the class MainFragment method loadlist.
/**
* This loads a path into the MainFragment.
*
* @param providedPath the path to be loaded
* @param back if we're coming back from any directory and want the scroll to be restored
* @param providedOpenMode the mode in which the directory should be opened
*/
public void loadlist(final String providedPath, final boolean back, final OpenMode providedOpenMode) {
if (mainFragmentViewModel == null) {
Log.w(getClass().getSimpleName(), "Viewmodel not available to load the data");
return;
}
if (getMainActivity() != null && getMainActivity().getActionModeHelper() != null && getMainActivity().getActionModeHelper().getActionMode() != null) {
getMainActivity().getActionModeHelper().getActionMode().finish();
}
mSwipeRefreshLayout.setRefreshing(true);
if (loadFilesListTask != null && loadFilesListTask.getStatus() == AsyncTask.Status.RUNNING) {
Log.w(getClass().getSimpleName(), "Existing load list task running, cancel current");
loadFilesListTask.cancel(true);
}
OpenMode openMode = providedOpenMode;
String actualPath = FileProperties.remapPathForApi30OrAbove(providedPath, false);
if (!providedPath.equals(actualPath) && SDK_INT >= Q) {
openMode = loadPathInQ(actualPath, providedPath, providedOpenMode);
} else // OpenMode.DOCUMENT_FILE
if (actualPath.startsWith("/") && OpenMode.DOCUMENT_FILE.equals(openMode)) {
openMode = OpenMode.FILE;
}
loadFilesListTask = new LoadFilesListTask(getActivity(), actualPath, this, openMode, getBoolean(PREFERENCE_SHOW_THUMB), getBoolean(PREFERENCE_SHOW_HIDDENFILES), (data) -> {
mSwipeRefreshLayout.setRefreshing(false);
if (data != null && data.second != null) {
boolean isPathLayoutGrid = DataUtils.getInstance().getListOrGridForPath(providedPath, DataUtils.LIST) == DataUtils.GRID;
setListElements(data.second, back, providedPath, data.first, false, isPathLayoutGrid);
} else {
Log.w(getClass().getSimpleName(), "Load list operation cancelled");
}
});
loadFilesListTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
Aggregations