- List<Integer> toHide = new ArrayList<Integer>();
- List<Integer> toShow = new ArrayList<Integer>();
- OCFile file = getFile();
-
- FileDownloaderBinder downloaderBinder = mContainerActivity.getFileDownloaderBinder();
- boolean downloading = downloaderBinder != null && downloaderBinder.isDownloading(mAccount, file);
- FileUploaderBinder uploaderBinder = mContainerActivity.getFileUploaderBinder();
- boolean uploading = uploaderBinder != null && uploaderBinder.isUploading(mAccount, getFile());
-
- if (downloading || uploading) {
- toHide.add(R.id.action_download_file);
- toHide.add(R.id.action_rename_file);
- toHide.add(R.id.action_remove_file);
- toHide.add(R.id.action_open_file_with);
- if (!downloading) {
- toHide.add(R.id.action_cancel_download);
- toShow.add(R.id.action_cancel_upload);
- } else {
- toHide.add(R.id.action_cancel_upload);
- toShow.add(R.id.action_cancel_download);
- }
-
- } else if (file != null && file.isDown()) {
- toHide.add(R.id.action_download_file);
- toHide.add(R.id.action_cancel_download);
- toHide.add(R.id.action_cancel_upload);
-
- toShow.add(R.id.action_rename_file);
- toShow.add(R.id.action_remove_file);
- toShow.add(R.id.action_open_file_with);
- toShow.add(R.id.action_sync_file);
-
- } else if (file != null) {
- toHide.add(R.id.action_open_file_with);
- toHide.add(R.id.action_cancel_download);
- toHide.add(R.id.action_cancel_upload);
- toHide.add(R.id.action_sync_file);
-
- toShow.add(R.id.action_rename_file);
- toShow.add(R.id.action_remove_file);
- toShow.add(R.id.action_download_file);
-
- } else {
- toHide.add(R.id.action_open_file_with);
- toHide.add(R.id.action_cancel_download);
- toHide.add(R.id.action_cancel_upload);
- toHide.add(R.id.action_sync_file);
- toHide.add(R.id.action_download_file);
- toHide.add(R.id.action_rename_file);
- toHide.add(R.id.action_remove_file);
-
- }
-
- // Options shareLink
- if (!file.isShareByLink()) {
- toHide.add(R.id.action_unshare_file);
- } else {
- toShow.add(R.id.action_unshare_file);