X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/2e47071c9c44d687b0c69a393807ea32fde08184..956a78753b58e95c1199dee32e88a464757b5061:/src/com/owncloud/android/operations/SynchronizeFolderOperation.java?ds=inline diff --git a/src/com/owncloud/android/operations/SynchronizeFolderOperation.java b/src/com/owncloud/android/operations/SynchronizeFolderOperation.java index 455ff63d..90921e65 100644 --- a/src/com/owncloud/android/operations/SynchronizeFolderOperation.java +++ b/src/com/owncloud/android/operations/SynchronizeFolderOperation.java @@ -30,26 +30,26 @@ import java.util.Map; import java.util.Vector; import org.apache.http.HttpStatus; + import android.accounts.Account; import android.content.Context; import android.content.Intent; +import android.util.Log; //import android.support.v4.content.LocalBroadcastManager; import com.owncloud.android.datamodel.FileDataStorageManager; import com.owncloud.android.datamodel.OCFile; - import com.owncloud.android.lib.common.OwnCloudClient; -import com.owncloud.android.lib.resources.shares.OCShare; import com.owncloud.android.lib.common.operations.RemoteOperation; import com.owncloud.android.lib.common.operations.RemoteOperationResult; import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode; import com.owncloud.android.lib.common.utils.Log_OC; -import com.owncloud.android.lib.resources.shares.GetRemoteSharesForFileOperation; import com.owncloud.android.lib.resources.files.FileUtils; import com.owncloud.android.lib.resources.files.ReadRemoteFileOperation; import com.owncloud.android.lib.resources.files.ReadRemoteFolderOperation; import com.owncloud.android.lib.resources.files.RemoteFile; - +import com.owncloud.android.lib.resources.shares.GetRemoteSharesForFileOperation; +import com.owncloud.android.lib.resources.shares.OCShare; import com.owncloud.android.syncadapter.FileSyncAdapter; import com.owncloud.android.utils.FileStorageUtils; @@ -121,14 +121,14 @@ public class SynchronizeFolderOperation extends RemoteOperation { /** * Creates a new instance of {@link SynchronizeFolderOperation}. * - * @param remoteFolderPath Remote folder to synchronize. + * @param folder Folder to synchronize. * @param currentSyncTime Time stamp for the synchronization process in progress. - * @param localFolderId Identifier in the local database of the folder - * to synchronize. - * @param updateFolderProperties 'True' means that the properties of the folder should - * be updated also, not just its content. * @param syncFullAccount 'True' means that this operation is part of a full account * synchronization. + * @param isShareSupported 'True' means that the server supports the sharing API. + * @param ignoreEtag 'True' means that the content of the remote folder should + * be fetched and updated even though the 'eTag' did not + * change. * @param dataStorageManager Interface with the local database. * @param account ownCloud account where the folder is located. * @param context Application context. @@ -198,7 +198,7 @@ public class SynchronizeFolderOperation extends RemoteOperation { if (mRemoteFolderChanged) { result = fetchAndSyncRemoteFolder(client); } else { - mChildren = mStorageManager.getFolderContent(mLocalFolder); + mChildren = mStorageManager.getFolderContent(mLocalFolder, false); } } @@ -325,7 +325,7 @@ public class SynchronizeFolderOperation extends RemoteOperation { private void synchronizeData(ArrayList folderAndFiles, OwnCloudClient client) { // get 'fresh data' from the database mLocalFolder = mStorageManager.getFileByPath(mLocalFolder.getRemotePath()); - + // parse data from remote folder OCFile remoteFolder = fillOCFile((RemoteFile)folderAndFiles.get(0)); remoteFolder.setParentId(mLocalFolder.getParentId()); @@ -338,7 +338,7 @@ public class SynchronizeFolderOperation extends RemoteOperation { List filesToSyncContents = new Vector(); // get current data about local contents of the folder to synchronize - List localFiles = mStorageManager.getFolderContent(mLocalFolder); + List localFiles = mStorageManager.getFolderContent(mLocalFolder, false); Map localFilesMap = new HashMap(localFiles.size()); for (OCFile file : localFiles) { localFilesMap.put(file.getRemotePath(), file); @@ -372,6 +372,10 @@ public class SynchronizeFolderOperation extends RemoteOperation { if (remoteFile.isFolder()) { remoteFile.setFileLength(localFile.getFileLength()); // TODO move operations about size of folders to FileContentProvider + } else if (mRemoteFolderChanged && remoteFile.isImage() && + remoteFile.getModificationTimestamp() != localFile.getModificationTimestamp()) { + remoteFile.setNeedsUpdateThumbnail(true); + Log.d(TAG, "Image " + remoteFile.getFileName() + " updated on the server"); } remoteFile.setPublicLink(localFile.getPublicLink()); remoteFile.setShareByLink(localFile.isShareByLink());