use of com.owncloud.android.ui.adapter.OCFileListAdapter in project android by nextcloud.
the class OCFileListFragment method selectAllFiles.
/**
* De-/select all elements in the current list view.
*
* @param select <code>true</code> to select all, <code>false</code> to deselect all
*/
public void selectAllFiles(boolean select) {
OCFileListAdapter ocFileListAdapter = (OCFileListAdapter) getRecyclerView().getAdapter();
if (select) {
ocFileListAdapter.addAllFilesToCheckedFiles();
} else {
ocFileListAdapter.removeAllFilesFromCheckedFiles();
}
for (int i = 0; i < mAdapter.getItemCount(); i++) {
mAdapter.notifyItemChanged(i);
}
mActiveActionMode.invalidate();
}
use of com.owncloud.android.ui.adapter.OCFileListAdapter in project android by nextcloud.
the class ExtendedListFragment method performSearch.
public void performSearch(final String query, boolean isBackPressed) {
handler.removeCallbacksAndMessages(null);
RecyclerView.Adapter adapter = getRecyclerView().getAdapter();
Activity activity = getActivity();
if (activity != null) {
if (activity instanceof FileDisplayActivity) {
if (isBackPressed && TextUtils.isEmpty(query)) {
FileDisplayActivity fileDisplayActivity = (FileDisplayActivity) activity;
fileDisplayActivity.resetSearchView();
fileDisplayActivity.updateListOfFilesFragment(true);
} else {
handler.post(() -> {
if (adapter instanceof OCFileListAdapter) {
if (accountManager.getUser().getServer().getVersion().isNewerOrEqual(OwnCloudVersion.nextcloud_20)) {
((FileDisplayActivity) activity).performUnifiedSearch(query);
} else {
EventBus.getDefault().post(new SearchEvent(query, SearchRemoteOperation.SearchType.FILE_SEARCH));
}
} else if (adapter instanceof LocalFileListAdapter) {
LocalFileListAdapter localFileListAdapter = (LocalFileListAdapter) adapter;
localFileListAdapter.filter(query);
}
});
if (searchView != null) {
searchView.clearFocus();
}
}
} else if (activity instanceof UploadFilesActivity) {
LocalFileListAdapter localFileListAdapter = (LocalFileListAdapter) adapter;
localFileListAdapter.filter(query);
((UploadFilesActivity) activity).showToolbarSpinner();
} else if (activity instanceof FolderPickerActivity) {
((FolderPickerActivity) activity).refreshListOfFilesFragment(true);
}
}
}
use of com.owncloud.android.ui.adapter.OCFileListAdapter in project android by nextcloud.
the class OCFileListFragment method onActivityCreated.
/**
* {@inheritDoc}
*/
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
Log_OC.i(TAG, "onActivityCreated() start");
if (savedInstanceState != null) {
mFile = savedInstanceState.getParcelable(KEY_FILE);
}
Bundle args = getArguments();
mOnlyFoldersClickable = args != null && args.getBoolean(ARG_ONLY_FOLDERS_CLICKABLE, false);
mFileSelectable = args != null && args.getBoolean(ARG_FILE_SELECTABLE, false);
mLimitToMimeType = args != null ? args.getString(ARG_MIMETYPE, "") : "";
boolean hideItemOptions = args != null && args.getBoolean(ARG_HIDE_ITEM_OPTIONS, false);
mAdapter = new OCFileListAdapter(getActivity(), accountManager.getUser(), preferences, mContainerActivity, this, hideItemOptions, isGridViewPreferred(mFile));
setRecyclerViewAdapter(mAdapter);
mHideFab = args != null && args.getBoolean(ARG_HIDE_FAB, false);
if (mHideFab) {
setFabVisible(false);
} else {
setFabVisible(true);
registerFabListener();
}
if (!searchFragment) {
// do not touch search event if previously searched
if (getArguments() == null) {
searchEvent = null;
} else {
searchEvent = getArguments().getParcelable(OCFileListFragment.SEARCH_EVENT);
}
}
prepareCurrentSearch(searchEvent);
if (mSortButton != null) {
mSortButton.setOnClickListener(v -> openSortingOrderDialogFragment(requireFragmentManager(), preferences.getSortOrderByFolder(mFile)));
}
if (mSwitchGridViewButton != null) {
mSwitchGridViewButton.setOnClickListener(v -> {
if (isGridEnabled()) {
setListAsPreferred();
} else {
setGridAsPreferred();
}
setGridSwitchButton();
});
}
setTitle();
FragmentActivity fragmentActivity;
if ((fragmentActivity = getActivity()) != null && fragmentActivity instanceof FileDisplayActivity) {
FileDisplayActivity fileDisplayActivity = (FileDisplayActivity) fragmentActivity;
fileDisplayActivity.updateActionBarTitleAndHomeButton(fileDisplayActivity.getCurrentDir());
}
listDirectory(false, false);
}
Aggregations