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