From: jabarros Date: Fri, 31 Oct 2014 12:30:26 +0000 (+0100) Subject: Fixed. When an image is updated in the server and app folder is refreshed, the thumbn... X-Git-Tag: oc-android-1.7.0_signed~121^2~3 X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/commitdiff_plain/639d12272170721020b345abbcfd8bfa0b4416d7 Fixed. When an image is updated in the server and app folder is refreshed, the thumbnail does not change and it is not updated --- diff --git a/src/com/owncloud/android/datamodel/FileDataStorageManager.java b/src/com/owncloud/android/datamodel/FileDataStorageManager.java index 5b1bef1b..41a51063 100644 --- a/src/com/owncloud/android/datamodel/FileDataStorageManager.java +++ b/src/com/owncloud/android/datamodel/FileDataStorageManager.java @@ -300,6 +300,7 @@ public class FileDataStorageManager { cv.put(ProviderTableMeta.FILE_PUBLIC_LINK, file.getPublicLink()); cv.put(ProviderTableMeta.FILE_PERMISSIONS, file.getPermissions()); cv.put(ProviderTableMeta.FILE_REMOTE_ID, file.getRemoteId()); + cv.put(ProviderTableMeta.FILE_UPDATE_THUMBNAIL, file.needsUpdateThumbnail()); boolean existsByPath = fileExists(file.getRemotePath()); if (existsByPath || fileExists(file.getFileId())) { diff --git a/src/com/owncloud/android/operations/SynchronizeFolderOperation.java b/src/com/owncloud/android/operations/SynchronizeFolderOperation.java index cdf12823..ff30bd0a 100644 --- a/src/com/owncloud/android/operations/SynchronizeFolderOperation.java +++ b/src/com/owncloud/android/operations/SynchronizeFolderOperation.java @@ -33,6 +33,7 @@ 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; @@ -323,9 +324,11 @@ public class SynchronizeFolderOperation extends RemoteOperation { * @return 'True' when any change was made in the local data, 'false' otherwise */ private void synchronizeData(ArrayList folderAndFiles, OwnCloudClient client) { + Vector mImageFiles = mStorageManager.getFolderImages(mLocalFolder); + // 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()); @@ -372,6 +375,15 @@ 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()) { + // If image has been updated on the server, set for updating the thumbnail + for (OCFile fileImage: mImageFiles) { + if (remoteFile.getRemoteId().equals(fileImage.getRemoteId()) && + remoteFile.getModificationTimestamp() > fileImage.getModificationTimestamp()) { + remoteFile.setNeedsUpdateThumbnail(true); + Log.d(TAG, "Image " + remoteFile.getFileName() + " updated on the server"); + } + } } remoteFile.setPublicLink(localFile.getPublicLink()); remoteFile.setShareByLink(localFile.isShareByLink());