X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/23c9be24a22ac4cfa78510ae3e58e5f0044a57ad..5b6475cc842a9d1fdeaf75901c1e31df37d2d490:/src/com/owncloud/android/syncadapter/FileSyncAdapter.java diff --git a/src/com/owncloud/android/syncadapter/FileSyncAdapter.java b/src/com/owncloud/android/syncadapter/FileSyncAdapter.java index 4b40ff49..2bb36729 100644 --- a/src/com/owncloud/android/syncadapter/FileSyncAdapter.java +++ b/src/com/owncloud/android/syncadapter/FileSyncAdapter.java @@ -149,7 +149,7 @@ public class FileSyncAdapter extends AbstractOwnCloudSyncAdapter { updateOCVersion(); mCurrentSyncTime = System.currentTimeMillis(); if (!mCancellation) { - synchronizeFolder(getStorageManager().getFileByPath(OCFile.PATH_SEPARATOR), true); + synchronizeFolder(getStorageManager().getFileByPath(OCFile.ROOT_PATH)); } else { Log_OC.d(TAG, "Leaving synchronization before synchronizing the root folder because cancelation request"); @@ -218,9 +218,8 @@ public class FileSyncAdapter extends AbstractOwnCloudSyncAdapter { * depth first strategy. * * @param folder Folder to synchronize. - * @param updateFolderProperties When 'true', updates also the properties of the of the target folder. */ - private void synchronizeFolder(OCFile folder, boolean updateFolderProperties) { + private void synchronizeFolder(OCFile folder) { if (mFailedResultsCounter > MAX_FAILED_RESULTS || isFinisher(mLastFailedResult)) return; @@ -239,7 +238,6 @@ public class FileSyncAdapter extends AbstractOwnCloudSyncAdapter { // folder synchronization SynchronizeFolderOperation synchFolderOp = new SynchronizeFolderOperation( folder, mCurrentSyncTime, - updateFolderProperties, true, getStorageManager(), getAccount(), @@ -261,13 +259,11 @@ public class FileSyncAdapter extends AbstractOwnCloudSyncAdapter { if (synchFolderOp.getForgottenLocalFiles().size() > 0) { mForgottenLocalFiles.putAll(synchFolderOp.getForgottenLocalFiles()); } - // synchronize children folders - List children = synchFolderOp.getChildren(); - fetchChildren(children); // beware of the 'hidden' recursion here! - - // update folder size again after recursive synchronization - getStorageManager().calculateFolderSize(folder.getFileId()); - sendStickyBroadcast(true, folder.getRemotePath(), null); // notify again + if (result.isSuccess() && synchFolderOp.getRemoteFolderChanged()) { + // synchronize children folders + List children = synchFolderOp.getChildren(); + fetchChildren(folder, children); // beware of the 'hidden' recursion here! + } } else { // in failures, the statistics for the global result are updated @@ -311,12 +307,15 @@ public class FileSyncAdapter extends AbstractOwnCloudSyncAdapter { * * @param files Files to recursively synchronize. */ - private void fetchChildren(List files) { + private void fetchChildren(OCFile parent, List files) { int i; for (i=0; i < files.size() && !mCancellation; i++) { OCFile newFile = files.get(i); - if (newFile.isDirectory()) { - synchronizeFolder(newFile, false); + if (newFile.isFolder()) { + synchronizeFolder(newFile); + // update the size of the parent folder again after recursive synchronization + getStorageManager().updateFolderSize(parent.getFileId()); + sendStickyBroadcast(true, parent.getRemotePath(), null); // notify again to refresh size in UI } }