pushDirname(directory);
cleanSecondFragment();
- syncFolderOperation(directory.getRemotePath(), directory.getFileId());
- // Update folder size on DB
- getStorageManager().calculateFolderSize(directory.getFileId());
+ // Sync Folder
+ startSyncFolderOperation(directory.getRemotePath(), directory.getFileId());
+// // Update folder size on DB
+// getStorageManager().calculateFolderSize(directory.getParentId());
}
* @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()) {
- refeshListOfFilesFragment();
+ 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);
}
+ private void refreshListOfFilesFragment(OCFile parentDir) {
+ OCFileListFragment fileListFragment = getListOfFilesFragment();
+ if (fileListFragment != null) {
+ fileListFragment.listDirectory(parentDir);
+ }
+ }
+
+
/**
* Updates the view associated to the activity after the finish of an operation trying to remove a
* file.
return null;
}
- public void syncFolderOperation(String remotePath, long parentId) {
- long currentSyncTime = System.currentTimeMillis();
- // perform folder synchronization
+ public void startSyncFolderOperation(String remotePath, long parentId) {
+ long currentSyncTime = System.currentTimeMillis();
+
+ OCFileListFragment list = getListOfFilesFragment();
+ enableDisableViewGroup(list.getListView(), false);
+
+ // perform folder synchronization
RemoteOperation synchFolderOp = new SynchronizeFolderOperation( remotePath,
currentSyncTime,
parentId,
);
synchFolderOp.execute(getAccount(), this, this, mHandler, this);
+ setSupportProgressBarIndeterminateVisibility(true);
}
+
+ public void enableDisableViewGroup(ViewGroup viewGroup, boolean enabled) {
+ int childCount = viewGroup.getChildCount();
+ for (int i = 0; i < childCount; i++) {
+ View view = viewGroup.getChildAt(i);
+ view.setEnabled(enabled);
+ view.setClickable(!enabled);
+ if (view instanceof ViewGroup) {
+ enableDisableViewGroup((ViewGroup) view, enabled);
+ }
+ }
+ }
}