The app goes directly to root folder when the current folder does not exist anymore after refreshing with server

This commit is contained in:
David A. Velasco 2013-10-08 15:06:20 +02:00
parent 79493448d9
commit ec85b4225e

View file

@ -881,7 +881,7 @@ OCFileListFragment.ContainerActivity, FileDetailFragment.ContainerActivity, OnNa
String.format(getString(R.string.sync_current_folder_was_removed), mDirectories.getItem(0)),
Toast.LENGTH_LONG)
.show();
onBackPressed();
jumpToRoot();
} else {
if (currentFile == null && !getFile().isDirectory()) {
@ -978,6 +978,21 @@ OCFileListFragment.ContainerActivity, FileDetailFragment.ContainerActivity, OnNa
}
public void jumpToRoot() {
OCFileListFragment listOfFiles = getListOfFilesFragment();
if (listOfFiles != null) { // should never be null, indeed
while (mDirectories.getCount() > 1) {
popDirname();
}
OCFile root = mStorageManager.getFileByPath(OCFile.PATH_SEPARATOR);
listOfFiles.listDirectory(root);
setFile(listOfFiles.getCurrentFile());
startSyncFolderOperation(root);
}
cleanSecondFragment();
}
/**
* {@inheritDoc}
*