use of com.owncloud.android.files.FileMenuFilter in project android by nextcloud.
the class OCFileListFragment method onOverflowIconClicked.
@Override
public void onOverflowIconClicked(OCFile file, View view) {
throttler.run("overflowClick", () -> {
PopupMenu popup = new PopupMenu(getActivity(), view);
popup.inflate(R.menu.item_file);
FileMenuFilter mf = new FileMenuFilter(mAdapter.getFiles().size(), Collections.singleton(file), mContainerActivity, getActivity(), true, accountManager.getUser());
mf.filter(popup.getMenu(), true);
popup.setOnMenuItemClickListener(item -> {
Set<OCFile> checkedFiles = new HashSet<>();
checkedFiles.add(file);
return onFileActionChosen(item, checkedFiles);
});
popup.show();
});
}
use of com.owncloud.android.files.FileMenuFilter in project android by nextcloud.
the class PreviewTextFileFragment method onPrepareOptionsMenu.
/**
* {@inheritDoc}
*/
@Override
public void onPrepareOptionsMenu(@NonNull Menu menu) {
super.onPrepareOptionsMenu(menu);
if (containerActivity.getStorageManager() != null) {
User user = accountManager.getUser();
FileMenuFilter mf = new FileMenuFilter(getFile(), containerActivity, getActivity(), false, user);
mf.filter(menu, true);
}
// additional restriction for this fragment
FileMenuFilter.hideMenuItems(menu.findItem(R.id.action_rename_file), menu.findItem(R.id.action_select_all), menu.findItem(R.id.action_move), menu.findItem(R.id.action_download_file), menu.findItem(R.id.action_sync_file), menu.findItem(R.id.action_favorite), menu.findItem(R.id.action_unset_favorite));
if (getFile().isSharedWithMe() && !getFile().canReshare()) {
FileMenuFilter.hideMenuItem(menu.findItem(R.id.action_send_share_file));
}
}