import android.accounts.OperationCanceledException;\r
import android.content.ContentProviderClient;\r
import android.content.Context;\r
+import android.content.Intent;\r
import android.content.SyncResult;\r
import android.os.Bundle;\r
import android.util.Log;\r
* @author Bartek Przybylski\r
*/\r
public class FileSyncAdapter extends AbstractOwnCloudSyncAdapter {\r
- private static final String TAG = "FileSyncAdapter";\r
\r
public FileSyncAdapter(Context context, boolean autoInitialize) {\r
super(context, autoInitialize);\r
this.setContentProvider(provider);\r
this.setStorageManager(new FileDataStorageManager(account, getContentProvider()));\r
\r
+ Log.d("ASD", "syncing owncloud account " + account.name);\r
+ \r
+ Intent i = new Intent(FileSyncService.SYNC_MESSAGE);\r
+ i.putExtra(FileSyncService.IN_PROGRESS, true);\r
+ i.putExtra(FileSyncService.ACCOUNT_NAME, account.name);\r
+ getContext().sendStickyBroadcast(i);\r
+ \r
PropFindMethod query;\r
try {\r
- query = new PropFindMethod(getUri().toString());\r
+ Log.e("ASD", getUri().toString());\r
+ query = new PropFindMethod(getUri().toString()+"/");\r
getClient().executeMethod(query);\r
MultiStatus resp = null;\r
resp = query.getResponseBodyAsMultiStatus();\r
+ \r
if (resp.getResponses().length > 0) {\r
WebdavEntry we = new WebdavEntry(resp.getResponses()[0]);\r
OCFile file = fillOCFile(we);\r
file.setParentId(0);\r
getStorageManager().saveFile(file);\r
- Log.d(TAG, file.getPath() + " " + file.getFileId());\r
fetchData(getUri().toString(), syncResult, file.getFileId());\r
}\r
} catch (OperationCanceledException e) {\r
syncResult.stats.numIoExceptions++;\r
e.printStackTrace();\r
}\r
- \r
+ i.putExtra(FileSyncService.IN_PROGRESS, false);\r
+ getContext().sendStickyBroadcast(i);\r
}\r
\r
private void fetchData(String uri, SyncResult syncResult, long parentId) {\r