+
+ } else if (operation instanceof SynchronizeFolderOperation) {
+ onSynchronizeFolderOperationFinish((SynchronizeFolderOperation)operation, result);
+ }
+ }
+
+
+ /**
+ * Updates the view associated to the activity after the finish of an operation trying to synchronize a folder.
+ *
+ * @param operation Synchronize operation performed.
+ * @param result Result of the synchronization.
+ */
+ private void onSynchronizeFolderOperationFinish(SynchronizeFolderOperation operation, RemoteOperationResult result) {
+
+ OCFileListFragment list = getListOfFilesFragment();
+ enableDisableViewGroup(list.getListView(), true);
+
+ setSupportProgressBarIndeterminateVisibility(false);
+ if (result.isSuccess()) {
+ if (result.getCode() != ResultCode.OK_NO_CHANGES_ON_DIR) {
+ DataStorageManager storageManager = getStorageManager();
+ OCFile parentDir = storageManager.getFileByPath(operation.getRemotePath());
+
+ // Update folder size on DB
+ getStorageManager().calculateFolderSize(parentDir.getFileId());
+
+ // Refrest List
+ refreshListOfFilesFragment(parentDir);
+ }
+ } else {
+ try {
+ Toast msg = Toast.makeText(FileDisplayActivity.this, R.string.sync_file_fail_msg, Toast.LENGTH_LONG);
+ msg.show();
+
+ } catch (NotFoundException e) {
+ Log_OC.e(TAG, "Error while trying to show fail message " , e);
+ }
+ }
+ }
+
+
+ private void refreshListOfFilesFragment(OCFile parentDir) {
+ OCFileListFragment fileListFragment = getListOfFilesFragment();
+ if (fileListFragment != null) {
+ fileListFragment.listDirectory(parentDir);