private void onRenameFileOperationFinish( RenameFileOperation operation, RemoteOperationResult result) { boolean inDisplayActivity = getActivity() instanceof FileDisplayActivity; getActivity() .dismissDialog( (inDisplayActivity) ? FileDisplayActivity.DIALOG_SHORT_WAIT : FileDetailActivity.DIALOG_SHORT_WAIT); if (result.isSuccess()) { updateFileDetails(((RenameFileOperation) operation).getFile(), mAccount); mContainerActivity.onFileStateChanged(); } else { if (result.getCode().equals(ResultCode.INVALID_LOCAL_FILE_NAME)) { Toast msg = Toast.makeText(getActivity(), R.string.rename_local_fail_msg, Toast.LENGTH_LONG); msg.show(); // TODO throw again the new rename dialog } else { Toast msg = Toast.makeText(getActivity(), R.string.rename_server_fail_msg, Toast.LENGTH_LONG); msg.show(); if (result.isSslRecoverableException()) { // TODO show the SSL warning dialog } } } }
@Override protected RemoteOperationResult run(WebdavClient client) { if (!isOnline()) { return new RemoteOperationResult(RemoteOperationResult.ResultCode.NO_NETWORK_CONNECTION); } if (mUrl.startsWith("http://") || mUrl.startsWith("https://")) { tryConnection(client, mUrl + AccountUtils.STATUS_PATH); } else { client.setBaseUri(Uri.parse("https://" + mUrl + AccountUtils.STATUS_PATH)); boolean httpsSuccess = tryConnection(client, "https://" + mUrl + AccountUtils.STATUS_PATH); if (!httpsSuccess && !mLatestResult.isSslRecoverableException()) { Log_OC.d(TAG, "establishing secure connection failed, trying non secure connection"); client.setBaseUri(Uri.parse("http://" + mUrl + AccountUtils.STATUS_PATH)); tryConnection(client, "http://" + mUrl + AccountUtils.STATUS_PATH); } } return mLatestResult; }
private void onRemoveFileOperationFinish( RemoveFileOperation operation, RemoteOperationResult result) { boolean inDisplayActivity = getActivity() instanceof FileDisplayActivity; getActivity() .dismissDialog( (inDisplayActivity) ? FileDisplayActivity.DIALOG_SHORT_WAIT : FileDetailActivity.DIALOG_SHORT_WAIT); if (result.isSuccess()) { Toast msg = Toast.makeText( getActivity().getApplicationContext(), R.string.remove_success_msg, Toast.LENGTH_LONG); msg.show(); if (inDisplayActivity) { // double pane FragmentTransaction transaction = getActivity().getSupportFragmentManager().beginTransaction(); transaction.replace( R.id.file_details_container, new FileDetailFragment(null, null)); // empty FileDetailFragment transaction.commit(); mContainerActivity.onFileStateChanged(); } else { getActivity().finish(); } } else { Toast msg = Toast.makeText(getActivity(), R.string.remove_fail_msg, Toast.LENGTH_LONG); msg.show(); if (result.isSslRecoverableException()) { // TODO show the SSL warning dialog } } }