mirror of
https://github.com/nextcloud/android.git
synced 2024-11-26 23:28:42 +03:00
Fixed. When an image is updated in the server and app folder is refreshed, the thumbnail does not change and it is not updated
This commit is contained in:
parent
595a63bc39
commit
639d122721
2 changed files with 14 additions and 1 deletions
|
@ -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())) {
|
||||
|
|
|
@ -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<Object> folderAndFiles, OwnCloudClient client) {
|
||||
Vector<OCFile> 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());
|
||||
|
|
Loading…
Reference in a new issue