From: David A. Velasco Date: Wed, 2 Oct 2013 08:40:03 +0000 (+0200) Subject: Fixed behaviour when user enters in a folder deleted in the server before the app... X-Git-Tag: oc-android-1.5.5~155^2~29 X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/commitdiff_plain/7c3fad35a3b4957bbb2557e98c5d2091c5132165?hp=--cc Fixed behaviour when user enters in a folder deleted in the server before the app finishes to synchronize --- 7c3fad35a3b4957bbb2557e98c5d2091c5132165 diff --git a/src/com/owncloud/android/operations/SynchronizeFolderOperation.java b/src/com/owncloud/android/operations/SynchronizeFolderOperation.java index b15119a8..a50bf956 100644 --- a/src/com/owncloud/android/operations/SynchronizeFolderOperation.java +++ b/src/com/owncloud/android/operations/SynchronizeFolderOperation.java @@ -276,24 +276,25 @@ public class SynchronizeFolderOperation extends RemoteOperation { } else { client.exhaustResponse(query.getResponseBodyAsStream()); } - } - - // prepare result object - if (!dirChanged) { - result = new RemoteOperationResult(ResultCode.OK_NO_CHANGES_ON_DIR); - mChildren = mStorageManager.getDirectoryContent(mStorageManager.getFileById(mParentId)); - - } else if (isMultiStatus(status)) { - if (mConflictsFound > 0 || mFailsInFavouritesFound > 0) { - result = new RemoteOperationResult(ResultCode.SYNC_CONFLICT); // should be different result, but will do the job + + + // prepare result object + if (!dirChanged) { + result = new RemoteOperationResult(ResultCode.OK_NO_CHANGES_ON_DIR); + mChildren = mStorageManager.getDirectoryContent(mStorageManager.getFileById(mParentId)); } else { - result = new RemoteOperationResult(true, status, query.getResponseHeaders()); + if (mConflictsFound > 0 || mFailsInFavouritesFound > 0) { + result = new RemoteOperationResult(ResultCode.SYNC_CONFLICT); // should be different result, but will do the job + + } else { + result = new RemoteOperationResult(true, status, query.getResponseHeaders()); + } } + } else { result = new RemoteOperationResult(false, status, query.getResponseHeaders()); } - Log_OC.i(TAG, "Synchronizing " + mAccount.name + ", folder " + mRemotePath + ": " + result.getLogMessage()); } catch (Exception e) { result = new RemoteOperationResult(e); @@ -303,12 +304,12 @@ public class SynchronizeFolderOperation extends RemoteOperation { if (query != null) query.releaseConnection(); // let the connection available for other methods if (result.isSuccess()) { - Log_OC.i(TAG, "Synchronizing " + mAccount.name + ", folder " + mRemotePath + ": " + result.getLogMessage()); + Log_OC.i(TAG, "Synchroned " + mAccount.name + ", folder " + mRemotePath + ": " + result.getLogMessage()); } else { if (result.isException()) { - Log_OC.e(TAG, "Synchronizing " + mAccount.name + ", folder " + mRemotePath + ": " + result.getLogMessage(), result.getException()); + Log_OC.e(TAG, "Synchroned " + mAccount.name + ", folder " + mRemotePath + ": " + result.getLogMessage(), result.getException()); } else { - Log_OC.e(TAG, "Synchronizing " + mAccount.name + ", folder " + mRemotePath + ": " + result.getLogMessage()); + Log_OC.e(TAG, "Synchroned " + mAccount.name + ", folder " + mRemotePath + ": " + result.getLogMessage()); } } diff --git a/src/com/owncloud/android/ui/activity/FileDisplayActivity.java b/src/com/owncloud/android/ui/activity/FileDisplayActivity.java index bacc6a92..f8867326 100644 --- a/src/com/owncloud/android/ui/activity/FileDisplayActivity.java +++ b/src/com/owncloud/android/ui/activity/FileDisplayActivity.java @@ -880,15 +880,19 @@ OCFileListFragment.ContainerActivity, FileDetailFragment.ContainerActivity, OnNa if ((synchFolderRemotePath != null && currentDir != null && (currentDir.getRemotePath().equals(synchFolderRemotePath))) || fillBlankRoot ) { - if (!fillBlankRoot) - currentDir = getStorageManager().getFileByPath(synchFolderRemotePath); - OCFileListFragment fileListFragment = getListOfFilesFragment(); - if (fileListFragment != null) { - fileListFragment.listDirectory(currentDir); - + if (synchResult == null || synchResult.isSuccess()) { + if (!fillBlankRoot) + currentDir = getStorageManager().getFileByPath(synchFolderRemotePath); + if (currentDir != null) { + OCFileListFragment fileListFragment = getListOfFilesFragment(); + if (fileListFragment != null) { + fileListFragment.listDirectory(currentDir); + + } + if (getSecondFragment() == null) + setFile(currentDir); + } } - if (getSecondFragment() == null) - setFile(currentDir); } setSupportProgressBarIndeterminateVisibility(inProgress);