+ /**\r
+ * Updates the view associated to the activity after the finish of some operation over files\r
+ * in the current account.\r
+ * \r
+ * @param operation Removal operation performed.\r
+ * @param result Result of the removal.\r
+ */\r
+ @Override\r
+ public void onRemoteOperationFinish(RemoteOperation operation, RemoteOperationResult result) {\r
+ if (operation instanceof RemoveFileOperation) {\r
+ onRemoveFileOperationFinish((RemoveFileOperation)operation, result);\r
+ \r
+ } else if (operation instanceof RenameFileOperation) {\r
+ onRenameFileOperationFinish((RenameFileOperation)operation, result);\r
+ }\r
+ }\r
+ \r
+ /**\r
+ * Updates the view associated to the activity after the finish of an operation trying to remove a \r
+ * file. \r
+ * \r
+ * @param operation Removal operation performed.\r
+ * @param result Result of the removal.\r
+ */\r
+ private void onRemoveFileOperationFinish(RemoveFileOperation operation, RemoteOperationResult result) {\r
+ dismissDialog(DIALOG_SHORT_WAIT);\r
+ if (result.isSuccess()) {\r
+ Toast msg = Toast.makeText(this, R.string.remove_success_msg, Toast.LENGTH_LONG);\r
+ msg.show();\r
+ OCFile removedFile = operation.getFile();\r
+ if (mDualPane) {\r
+ FileDetailFragment details = (FileDetailFragment) getSupportFragmentManager().findFragmentByTag(FileDetailFragment.FTAG);\r
+ if (details != null && removedFile.equals(details.getDisplayedFile()) ) {\r
+ FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();\r
+ transaction.replace(R.id.file_details_container, new FileDetailFragment(null, null)); // empty FileDetailFragment\r
+ transaction.commit();\r
+ }\r
+ }\r
+ if (mStorageManager.getFileById(removedFile.getParentId()).equals(mCurrentDir)) {\r
+ mFileList.listDirectory();\r
+ }\r
+ \r
+ } else {\r
+ Toast msg = Toast.makeText(this, R.string.remove_fail_msg, Toast.LENGTH_LONG); \r
+ msg.show();\r
+ if (result.isSslRecoverableException()) {\r
+ mLastSslUntrustedServerResult = result;\r
+ showDialog(DIALOG_SSL_VALIDATOR); \r
+ }\r
+ }\r
+ }\r
+\r
+ /**\r
+ * Updates the view associated to the activity after the finish of an operation trying to rename a \r
+ * file. \r
+ * \r
+ * @param operation Renaming operation performed.\r
+ * @param result Result of the renaming.\r
+ */\r
+ private void onRenameFileOperationFinish(RenameFileOperation operation, RemoteOperationResult result) {\r
+ dismissDialog(DIALOG_SHORT_WAIT);\r
+ OCFile renamedFile = operation.getFile();\r
+ if (result.isSuccess()) {\r
+ if (mDualPane) {\r
+ FileDetailFragment details = (FileDetailFragment) getSupportFragmentManager().findFragmentByTag(FileDetailFragment.FTAG);\r
+ if (details != null && renamedFile.equals(details.getDisplayedFile()) ) {\r
+ details.updateFileDetails(renamedFile, AccountUtils.getCurrentOwnCloudAccount(this));\r
+ }\r
+ }\r
+ if (mStorageManager.getFileById(renamedFile.getParentId()).equals(mCurrentDir)) {\r
+ mFileList.listDirectory();\r
+ }\r
+ \r
+ } else {\r
+ if (result.getCode().equals(ResultCode.INVALID_LOCAL_FILE_NAME)) {\r
+ Toast msg = Toast.makeText(this, R.string.rename_local_fail_msg, Toast.LENGTH_LONG); \r
+ msg.show();\r
+ // TODO throw again the new rename dialog\r
+ } else {\r
+ Toast msg = Toast.makeText(this, R.string.rename_server_fail_msg, Toast.LENGTH_LONG); \r
+ msg.show();\r
+ if (result.isSslRecoverableException()) {\r
+ mLastSslUntrustedServerResult = result;\r
+ showDialog(DIALOG_SSL_VALIDATOR); \r
+ }\r
+ }\r
+ }\r
+ }\r
+\r
+\r
+ /**\r
+ * {@inheritDoc}\r
+ */\r
+ @Override\r
+ public void onTransferStateChanged(OCFile file, boolean downloading, boolean uploading) {\r
+ /*OCFileListFragment fileListFragment = (OCFileListFragment) getSupportFragmentManager().findFragmentById(R.id.fileList);\r
+ if (fileListFragment != null) { \r
+ fileListFragment.listDirectory();\r
+ }*/\r
+ if (mDualPane) {\r
+ FileDetailFragment details = (FileDetailFragment) getSupportFragmentManager().findFragmentByTag(FileDetailFragment.FTAG);\r
+ if (details != null && file.equals(details.getDisplayedFile()) ) {\r
+ if (downloading || uploading) {\r
+ details.updateFileDetails(file, AccountUtils.getCurrentOwnCloudAccount(this));\r
+ } else {\r
+ details.updateFileDetails(downloading || uploading);\r
+ }\r
+ }\r
+ }\r
+ }\r
+\r
+\r
+ \r
+\r
+\r