cleanSecondFragment();
// Sync Folder
- syncFolderOperation(directory.getRemotePath(), directory.getFileId());
+ 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) {
+ setSupportProgressBarIndeterminateVisibility(false);
if (result.isSuccess()) {
- refeshListOfFilesFragment();
-
+ DataStorageManager storageManager = getStorageManager();
+ OCFile parentDir = storageManager.getFileById(operation.getParentId());
+
+ 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();
+ setSupportProgressBarIndeterminateVisibility(true);
+ // perform folder synchronization
RemoteOperation synchFolderOp = new SynchronizeFolderOperation( remotePath,
currentSyncTime,
parentId,
if(mFile != null){
DataStorageManager storageManager = mContainerActivity.getStorageManager();
- parentDir = storageManager.getFileById(mFile.getParentId());
+ if (mFile.getParentId() == 0) {
+ parentDir = storageManager.getFileById(1);
+ }
+ else {
+ parentDir = storageManager.getFileById(mFile.getParentId());
+ }
// Update folder size on DB
storageManager.calculateFolderSize(mFile.getFileId());
- mFile = parentDir;
-
+ mFile = parentDir;
}
- listDirectory(parentDir);
-
+
+ if (mFile != null) {
+ listDirectory(mFile);
- mContainerActivity.syncFolderOperation(mFile.getRemotePath(), mFile.getParentId());
+ mContainerActivity.startSyncFolderOperation(mFile.getRemotePath(), mFile.getParentId());
+ }
}
public void startImagePreview(OCFile file);
- public void syncFolderOperation(String remotePath, long parentId);
+ public void startSyncFolderOperation(String remotePath, long parentId);
/**
* Getter for the current DataStorageManager in the container activity