-->\r
<manifest package="eu.alefzero.owncloud"\r
android:versionCode="1"\r
- android:versionName="0.1.143B" xmlns:android="http://schemas.android.com/apk/res/android">\r
+ android:versionName="0.1.144B" xmlns:android="http://schemas.android.com/apk/res/android">\r
\r
<uses-permission android:name="android.permission.GET_ACCOUNTS" />\r
<uses-permission android:name="android.permission.USE_CREDENTIALS" />\r
import java.io.IOException;\r
import java.util.ArrayList;\r
import java.util.Iterator;\r
+import java.util.LinkedList;\r
import java.util.List;\r
+import java.util.Queue;\r
import java.util.Vector;\r
\r
import org.apache.jackrabbit.webdav.DavException;\r
\r
Log.d(TAG, "syncing owncloud account " + account.name);\r
\r
- sendStickyBroadcast(true, -1); // starting message to UI\r
+ sendStickyBroadcast(true, -1); // message to signal the start to the UI\r
\r
PropFindMethod query;\r
try {\r
getClient().executeMethod(query);\r
MultiStatus resp = null;\r
resp = query.getResponseBodyAsMultiStatus();\r
- List<String> paths = new ArrayList<String>();\r
- List<Long> fileIds = new ArrayList<Long>(); \r
+ Queue<String> paths = new LinkedList<String>();\r
+ Queue<Long> fileIds = new LinkedList<Long>(); \r
for (int i = 1; i < resp.getResponses().length; ++i) {\r
WebdavEntry we = new WebdavEntry(resp.getResponses()[i], getUri().getPath());\r
OCFile file = fillOCFile(we);\r
sendStickyBroadcast(true, parentId);\r
\r
// recursive fetch\r
- Iterator<String> pathsIt = paths.iterator();\r
- Iterator<Long> fileIdsIt = fileIds.iterator();\r
- while (pathsIt.hasNext()) {\r
- fetchData(getUri().toString() + pathsIt.next(), syncResult, fileIdsIt.next());\r
+ while(!paths.isEmpty()) {\r
+ fetchData(getUri().toString() + paths.remove(), syncResult, fileIds.remove());\r
}\r
+ paths = null;\r
+ fileIds = null;\r
\r
\r
} catch (OperationCanceledException e) {\r
FileSyncService.IN_PROGRESS, false);\r
String account_name = intent\r
.getStringExtra(FileSyncService.ACCOUNT_NAME);\r
+\r
Log.d("FileDisplay", "sync of account " + account_name\r
+ " is in_progress: " + inProgress);\r
- setSupportProgressBarIndeterminateVisibility(inProgress);\r
+\r
+ //if (account_name.equals(AccountUtils.getCurrentOwnCloudAccount(context).name)) { // TODO - probably this check should be added, but won't push it until really tests are done; no time now\r
\r
- long OCDirId = intent.getLongExtra(FileSyncService.SYNC_FOLDER, -1);\r
- if (OCDirId >= 0) {\r
- OCFile syncDir = mStorageManager.getFileById(OCDirId);\r
- if (syncDir != null && (\r
- (mCurrentDir == null && syncDir.getFileName().equals("/")) ||\r
- syncDir.equals(mCurrentDir))\r
- ) {\r
- FileListFragment fileListFragment = (FileListFragment) getSupportFragmentManager().findFragmentById(R.id.fileList);\r
- if (fileListFragment != null) { \r
- fileListFragment.listDirectory();\r
+ /// try to refresh the view with every message received from the FileSyncAdapter; brute, but more user friendly when there are a lot of files in the server\r
+ OCFile currentDir;\r
+ if (mCurrentDir == null)\r
+ currentDir = mStorageManager.getFileByPath("/");\r
+ else\r
+ currentDir = mStorageManager.getFileByPath(mCurrentDir.getRemotePath());\r
+ \r
+ if (currentDir != null) {\r
+ mCurrentDir = currentDir;\r
+ FileListFragment fileListFragment = (FileListFragment) getSupportFragmentManager()\r
+ .findFragmentById(R.id.fileList);\r
+ if (fileListFragment != null) {\r
+ if (!mCurrentDir.equals(fileListFragment.getCurrentFile())) {\r
+ fileListFragment.listDirectory(mCurrentDir); // only set the directory in the fragment first time\r
+ } else\r
+ fileListFragment.listDirectory(); // enough to show new files in the current directory if they are added after \r
}\r
}\r
- }\r
- \r
- if (!inProgress) {\r
- FileListFragment fileListFragment = (FileListFragment) getSupportFragmentManager()\r
- .findFragmentById(R.id.fileList);\r
- if (fileListFragment != null)\r
- fileListFragment.listDirectory();\r
- }\r
+ \r
+ setSupportProgressBarIndeterminateVisibility(inProgress);\r
+ //}\r
}\r
-\r
}\r
\r
\r