From: David A. Velasco Date: Wed, 2 Oct 2013 16:08:01 +0000 (+0200) Subject: Exit the current folder when not existing in the server any more (2) X-Git-Tag: oc-android-1.5.5~155^2~27 X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/commitdiff_plain/74370d5dee77282a8f71f787890b625a9f6a3aa0 Exit the current folder when not existing in the server any more (2) --- diff --git a/res/values/strings.xml b/res/values/strings.xml index 38014550..400684b7 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -129,7 +129,7 @@ Some local files were forgotten %1$d files out of the %2$s directory could not be copied into As of version 1.3.16, files uploaded from this device are copied into the local %1$s folder to prevent data loss when a single file is synced with multiple accounts.\n\nDue to this change, all files uploaded in previous versions of this app were copied into the %2$s folder. However, an error prevented the completion of this operation during account synchronization. You may either leave the file(s) as is and remove the link to %3$s, or move the file(s) into the %1$s directory and retain the link to %4$s.\n\nListed below are the local file(s), and the the remote file(s) in %5$s they were linked to. - Current folder was removed\n Browsing up to %1$s + Current folder was removed "Move all" "All files were moved" "Some files could not be moved" diff --git a/src/com/owncloud/android/operations/SynchronizeFolderOperation.java b/src/com/owncloud/android/operations/SynchronizeFolderOperation.java index 7f22bb7a..3c9c6544 100644 --- a/src/com/owncloud/android/operations/SynchronizeFolderOperation.java +++ b/src/com/owncloud/android/operations/SynchronizeFolderOperation.java @@ -297,7 +297,7 @@ public class SynchronizeFolderOperation extends RemoteOperation { OCFile dir = mStorageManager.getFileByPath(mRemotePath); if (dir != null) { String currentSavePath = FileStorageUtils.getSavePath(mAccount.name); - mStorageManager.removeFile(dir, (dir.isDown() && dir.getStoragePath().startsWith(currentSavePath))); + mStorageManager.removeDirectory(dir, true, (dir.isDown() && dir.getStoragePath().startsWith(currentSavePath))); } } result = new RemoteOperationResult(false, status, query.getResponseHeaders()); diff --git a/src/com/owncloud/android/ui/activity/FileDisplayActivity.java b/src/com/owncloud/android/ui/activity/FileDisplayActivity.java index f62eb078..2d44f135 100644 --- a/src/com/owncloud/android/ui/activity/FileDisplayActivity.java +++ b/src/com/owncloud/android/ui/activity/FileDisplayActivity.java @@ -879,14 +879,20 @@ OCFileListFragment.ContainerActivity, FileDetailFragment.ContainerActivity, OnNa } */ - OCFile currentDir = getCurrentDir(); - if (synchFolderRemotePath != null) { + OCFile currentDir = mStorageManager.getFileById(getCurrentDir().getFileId()); + if (currentDir == null) { + // current folder was removed from the server + Toast.makeText(FileDisplayActivity.this, getString(R.string.sync_current_folder_was_removed), Toast.LENGTH_LONG) + .show(); + onBackPressed(); + + } else if (synchFolderRemotePath != null && currentDir.getRemotePath().equals(synchFolderRemotePath)) { - OCFile synchDir = getStorageManager().getFileByPath(synchFolderRemotePath); - boolean needToRefresh = false; + /*OCFile synchDir = getStorageManager().getFileByPath(synchFolderRemotePath); + //boolean needToRefresh = false; if (synchDir == null) { - Log_OC.e(TAG, "SEARCHING NEW CURRENT"); // after synchronizing the current folder does not exist (was deleted in the server) ; need to move to other + /* String synchPath = synchFolderRemotePath; do { String synchParentPath = new File(synchPath).getParent(); @@ -896,29 +902,25 @@ OCFileListFragment.ContainerActivity, FileDetailFragment.ContainerActivity, OnNa synchPath = synchParentPath; } while (synchDir == null); // sooner of later will get ROOT, that never is null currentDir = synchDir; - + *-/ Toast.makeText(FileDisplayActivity.this, - String.format(getString(R.string.sync_current_folder_was_removed), synchPath), + String.format(getString(R.string.sync_current_folder_was_removed), "LOLO"), Toast.LENGTH_LONG).show(); - needToRefresh = true; - } + //needToRefresh = true; + onBackPressed(); + } else {*/ - if (currentDir.getRemotePath().equals(synchFolderRemotePath)) { - needToRefresh = true; + OCFileListFragment fileListFragment = getListOfFilesFragment(); + if (fileListFragment != null) { + fileListFragment.listDirectory(currentDir); } - - if (needToRefresh) { - OCFileListFragment fileListFragment = getListOfFilesFragment(); - if (fileListFragment != null) { - fileListFragment.listDirectory(currentDir); - } - boolean existsSecondFragment = (getSecondFragment() != null); - if (!existsSecondFragment) { - setFile(currentDir); - } - //updateFragmentsVisibility(existsSecondFragment); - updateNavigationElementsInActionBar(existsSecondFragment ? getFile() : null); + //boolean existsSecondFragment = (getSecondFragment() != null); + //if (!existsSecondFragment) { + if (getSecondFragment() == null) { + setFile(currentDir); } + //updateFragmentsVisibility(existsSecondFragment); + //updateNavigationElementsInActionBar(existsSecondFragment ? getFile() : null); } setSupportProgressBarIndeterminateVisibility(inProgress);