- case R.id.action_rename_file: {
- String fileName = mTargetFile.getFileName();
- int extensionStart = mTargetFile.isFolder() ? -1 : fileName.lastIndexOf(".");
- int selectionEnd = (extensionStart >= 0) ? extensionStart : fileName.length();
- EditNameDialog dialog = EditNameDialog.newInstance(getString(R.string.rename_dialog_title), fileName, 0, selectionEnd, this);
- dialog.show(getFragmentManager(), EditNameDialog.TAG);
- return true;
- }
- case R.id.action_remove_file: {
- int messageStringId = R.string.confirmation_remove_alert;
- int posBtnStringId = R.string.confirmation_remove_remote;
- int neuBtnStringId = -1;
- if (mTargetFile.isFolder()) {
- messageStringId = R.string.confirmation_remove_folder_alert;
- posBtnStringId = R.string.confirmation_remove_remote_and_local;
- neuBtnStringId = R.string.confirmation_remove_folder_local;
- } else if (mTargetFile.isDown()) {
- posBtnStringId = R.string.confirmation_remove_remote_and_local;
- neuBtnStringId = R.string.confirmation_remove_local;
- }
- ConfirmationDialogFragment confDialog = ConfirmationDialogFragment.newInstance(
- messageStringId,
- new String[]{mTargetFile.getFileName()},
- posBtnStringId,
- neuBtnStringId,
- R.string.common_cancel);
- confDialog.setOnConfirmationListener(this);
- confDialog.show(getFragmentManager(), FileDetailFragment.FTAG_CONFIRMATION);
- return true;
- }
- case R.id.action_sync_file: {
- Account account = AccountUtils.getCurrentOwnCloudAccount(getSherlockActivity());
- RemoteOperation operation = new SynchronizeFileOperation(mTargetFile, null, mContainerActivity.getStorageManager(), account, true, getSherlockActivity());
- operation.execute(account, getSherlockActivity(), mContainerActivity, mHandler, getSherlockActivity());
- ((FileDisplayActivity) getSherlockActivity()).showLoadingDialog();
- return true;
- }
- case R.id.action_cancel_download: {
- FileDownloaderBinder downloaderBinder = mContainerActivity.getFileDownloaderBinder();
- Account account = AccountUtils.getCurrentOwnCloudAccount(getActivity());
- if (downloaderBinder != null && downloaderBinder.isDownloading(account, mTargetFile)) {
- downloaderBinder.cancel(account, mTargetFile);
- listDirectory();
- mContainerActivity.onTransferStateChanged(mTargetFile, false, false);
- }
- return true;
+ case R.id.action_rename_file: {
+ String fileName = mTargetFile.getFileName();
+ int extensionStart = mTargetFile.isFolder() ? -1 : fileName.lastIndexOf(".");
+ int selectionEnd = (extensionStart >= 0) ? extensionStart : fileName.length();
+ EditNameDialog dialog = EditNameDialog.newInstance(getString(R.string.rename_dialog_title), fileName, 0,
+ selectionEnd, this);
+ dialog.show(getFragmentManager(), EditNameDialog.TAG);
+ return true;
+ }
+ case R.id.action_remove_file: {
+ int messageStringId = R.string.confirmation_remove_alert;
+ int posBtnStringId = R.string.confirmation_remove_remote;
+ int neuBtnStringId = -1;
+ if (mTargetFile.isFolder()) {
+ messageStringId = R.string.confirmation_remove_folder_alert;
+ posBtnStringId = R.string.confirmation_remove_remote_and_local;
+ neuBtnStringId = R.string.confirmation_remove_folder_local;
+ } else if (mTargetFile.isDown()) {
+ posBtnStringId = R.string.confirmation_remove_remote_and_local;
+ neuBtnStringId = R.string.confirmation_remove_local;