X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/b694fee63d7bdb8b93e9d46d28303eff094923fe..refs/heads/master:/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 43ddae33..f04c8dac 100644 --- a/src/com/owncloud/android/syncadapter/FileSyncAdapter.java +++ b/src/com/owncloud/android/syncadapter/FileSyncAdapter.java @@ -30,7 +30,6 @@ import java.util.Map; import org.apache.jackrabbit.webdav.DavException; -import com.owncloud.android.MainApp; import com.owncloud.android.R; import com.owncloud.android.authentication.AuthenticatorActivity; import com.owncloud.android.datamodel.FileDataStorageManager; @@ -59,7 +58,7 @@ import android.support.v4.app.NotificationCompat; * Implementation of {@link AbstractThreadedSyncAdapter} responsible for synchronizing * ownCloud files. * - * Performs a full synchronization of the account recieved in {@link #onPerformSync(Account, Bundle, + * Performs a full synchronization of the account received in {@link #onPerformSync(Account, Bundle, * String, ContentProviderClient, SyncResult)}. */ public class FileSyncAdapter extends AbstractOwnCloudSyncAdapter { @@ -77,9 +76,7 @@ public class FileSyncAdapter extends AbstractOwnCloudSyncAdapter { ".EVENT_FULL_SYNC_END"; public static final String EVENT_FULL_SYNC_FOLDER_CONTENTS_SYNCED = FileSyncAdapter.class.getName() + ".EVENT_FULL_SYNC_FOLDER_CONTENTS_SYNCED"; - //public static final String EVENT_FULL_SYNC_FOLDER_SIZE_SYNCED = - // FileSyncAdapter.class.getName() + ".EVENT_FULL_SYNC_FOLDER_SIZE_SYNCED"; - + public static final String EXTRA_ACCOUNT_NAME = FileSyncAdapter.class.getName() + ".EXTRA_ACCOUNT_NAME"; public static final String EXTRA_FOLDER_PATH = FileSyncAdapter.class.getName() + @@ -268,16 +265,6 @@ public class FileSyncAdapter extends AbstractOwnCloudSyncAdapter { if (mFailedResultsCounter > MAX_FAILED_RESULTS || isFinisher(mLastFailedResult)) return; - /* - OCFile folder, - long currentSyncTime, - boolean updateFolderProperties, - boolean syncFullAccount, - DataStorageManager dataStorageManager, - Account account, - Context context ) { - } - */ // folder synchronization RefreshFolderOperation synchFolderOp = new RefreshFolderOperation( folder, mCurrentSyncTime, @@ -308,10 +295,10 @@ public class FileSyncAdapter extends AbstractOwnCloudSyncAdapter { // synchronize children folders List children = synchFolderOp.getChildren(); // beware of the 'hidden' recursion here! - fetchChildren(folder, children, synchFolderOp.getRemoteFolderChanged()); + syncChildren(children); } - } else { + } else if (result.getCode() != ResultCode.FILE_NOT_FOUND) { // in failures, the statistics for the global result are updated if ( result.getCode() == RemoteOperationResult.ResultCode.UNAUTHORIZED || result.isIdPRedirection() @@ -326,7 +313,10 @@ public class FileSyncAdapter extends AbstractOwnCloudSyncAdapter { } mFailedResultsCounter++; mLastFailedResult = result; - } + + } // else, ResultCode.FILE_NOT_FOUND is ignored, remote folder was + // removed from other thread or other client during the synchronization, + // before this thread fetched its contents } @@ -351,25 +341,19 @@ public class FileSyncAdapter extends AbstractOwnCloudSyncAdapter { /** * Triggers the synchronization of any folder contained in the list of received files. + * + * No consideration of etag here because it MUST walk down anyway, in case that kept-in-sync files + * have local changes. * * @param files Files to recursively synchronize. */ - private void fetchChildren(OCFile parent, List files, boolean parentEtagChanged) { + private void syncChildren(List files) { int i; - OCFile newFile = null; - //String etag = null; - //boolean syncDown = false; + OCFile newFile; for (i=0; i < files.size() && !mCancellation; i++) { newFile = files.get(i); if (newFile.isFolder()) { - /* - etag = newFile.getEtag(); - syncDown = (parentEtagChanged || etag == null || etag.length() == 0); - if(syncDown) { */ - synchronizeFolder(newFile); - //sendLocalBroadcast(EVENT_FULL_SYNC_FOLDER_SIZE_SYNCED, parent.getRemotePath(), - // null); - //} + synchronizeFolder(newFile); } } @@ -526,6 +510,7 @@ public class FileSyncAdapter extends AbstractOwnCloudSyncAdapter { private NotificationCompat.Builder createNotificationBuilder() { NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(getContext()); notificationBuilder.setSmallIcon(R.drawable.notification_icon).setAutoCancel(true); + notificationBuilder.setColor(getContext().getResources().getColor(R.color.primary)); return notificationBuilder; }