Merge branch '1193_uploader_layout' of https://github.com/owncloud/android into beta
[pub/Android/ownCloud.git] / src / com / owncloud / android / operations / RefreshFolderOperation.java
index cf5bccd..c61446e 100644 (file)
@@ -196,7 +196,7 @@ public class RefreshFolderOperation extends RemoteOperation {
                 result = fetchAndSyncRemoteFolder(client);
             } else {
                 fetchFavoritesToSyncFromLocalData();
                 result = fetchAndSyncRemoteFolder(client);
             } else {
                 fetchFavoritesToSyncFromLocalData();
-                mChildren = mStorageManager.getFolderContent(mLocalFolder/*, false*/);
+                mChildren = mStorageManager.getFolderContent(mLocalFolder, false);
             }
 
             if (result.isSuccess()) {
             }
 
             if (result.isSuccess()) {
@@ -346,8 +346,7 @@ public class RefreshFolderOperation extends RemoteOperation {
         mFilesToSyncContents.clear();
 
         // get current data about local contents of the folder to synchronize
         mFilesToSyncContents.clear();
 
         // get current data about local contents of the folder to synchronize
-        // TODO Enable when "On Device" is recovered ?
-        List<OCFile> localFiles = mStorageManager.getFolderContent(mLocalFolder/*, false*/);
+        List<OCFile> localFiles = mStorageManager.getFolderContent(mLocalFolder, false);
         Map<String, OCFile> localFilesMap = new HashMap<String, OCFile>(localFiles.size());
         for (OCFile file : localFiles) {
             localFilesMap.put(file.getRemotePath(), file);
         Map<String, OCFile> localFilesMap = new HashMap<String, OCFile>(localFiles.size());
         for (OCFile file : localFiles) {
             localFilesMap.put(file.getRemotePath(), file);
@@ -391,8 +390,9 @@ public class RefreshFolderOperation extends RemoteOperation {
                     Log.d(TAG, "Image " + remoteFile.getFileName() + " updated on the server");
                 }
                 updatedFile.setPublicLink(localFile.getPublicLink());
                     Log.d(TAG, "Image " + remoteFile.getFileName() + " updated on the server");
                 }
                 updatedFile.setPublicLink(localFile.getPublicLink());
-                updatedFile.setShareByLink(localFile.isShareByLink());
-                updatedFile.setInConflict(localFile.isInConflict());
+                updatedFile.setShareViaLink(localFile.isSharedViaLink());
+                updatedFile.setShareWithSharee(localFile.isSharedWithSharee());
+                updatedFile.setEtagInConflict(localFile.getEtagInConflict());
             } else {
                 // remote eTag will not be updated unless file CONTENTS are synchronized
                 updatedFile.setEtag("");
             } else {
                 // remote eTag will not be updated unless file CONTENTS are synchronized
                 updatedFile.setEtag("");
@@ -456,12 +456,19 @@ public class RefreshFolderOperation extends RemoteOperation {
     }
 
 
     }
 
 
+    /**
+     * Syncs the Share resources for the files contained in the folder refreshed (children, not deeper descendants).
+     *
+     * @param client    Handler of a session with an OC server.
+     * @return          The result of the remote operation retrieving the Share resources in the folder refreshed by
+     *                  the operation.
+     */
     private RemoteOperationResult refreshSharesForFolder(OwnCloudClient client) {
         RemoteOperationResult result = null;
         
         // remote request 
         GetRemoteSharesForFileOperation operation = 
     private RemoteOperationResult refreshSharesForFolder(OwnCloudClient client) {
         RemoteOperationResult result = null;
         
         // remote request 
         GetRemoteSharesForFileOperation operation = 
-                new GetRemoteSharesForFileOperation(mLocalFolder.getRemotePath(), false, true);
+                new GetRemoteSharesForFileOperation(mLocalFolder.getRemotePath(), true, true);
         result = operation.execute(client);
         
         if (result.isSuccess()) {
         result = operation.execute(client);
         
         if (result.isSuccess()) {
@@ -502,7 +509,7 @@ public class RefreshFolderOperation extends RemoteOperation {
 
 
     private void fetchFavoritesToSyncFromLocalData() {
 
 
     private void fetchFavoritesToSyncFromLocalData() {
-        List<OCFile> children = mStorageManager.getFolderContent(mLocalFolder);
+        List<OCFile> children = mStorageManager.getFolderContent(mLocalFolder, false);
         for (OCFile child : children) {
             if (!child.isFolder() && child.isFavorite()) {
                 SynchronizeFileOperation operation = new SynchronizeFileOperation(
         for (OCFile child : children) {
             if (!child.isFolder() && child.isFavorite()) {
                 SynchronizeFileOperation operation = new SynchronizeFileOperation(