X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/e0937de63de3ec475d541a5a28fae303167b0e93..fdb9149e0e0047299bf986006db4a6b0a10f0947:/src/eu/alefzero/owncloud/syncadapter/FileSyncAdapter.java diff --git a/src/eu/alefzero/owncloud/syncadapter/FileSyncAdapter.java b/src/eu/alefzero/owncloud/syncadapter/FileSyncAdapter.java index 95c142dd..63e99d59 100644 --- a/src/eu/alefzero/owncloud/syncadapter/FileSyncAdapter.java +++ b/src/eu/alefzero/owncloud/syncadapter/FileSyncAdapter.java @@ -29,6 +29,7 @@ import android.accounts.AuthenticatorException; import android.accounts.OperationCanceledException; import android.content.ContentProviderClient; import android.content.Context; +import android.content.Intent; import android.content.SyncResult; import android.os.Bundle; import android.util.Log; @@ -43,7 +44,6 @@ import eu.alefzero.webdav.WebdavEntry; * @author Bartek Przybylski */ public class FileSyncAdapter extends AbstractOwnCloudSyncAdapter { - private static final String TAG = "FileSyncAdapter"; public FileSyncAdapter(Context context, boolean autoInitialize) { super(context, autoInitialize); @@ -61,18 +61,26 @@ public class FileSyncAdapter extends AbstractOwnCloudSyncAdapter { this.setContentProvider(provider); this.setStorageManager(new FileDataStorageManager(account, getContentProvider())); + Log.d("ASD", "syncing owncloud account " + account.name); + + Intent i = new Intent(FileSyncService.SYNC_MESSAGE); + i.putExtra(FileSyncService.IN_PROGRESS, true); + i.putExtra(FileSyncService.ACCOUNT_NAME, account.name); + getContext().sendStickyBroadcast(i); + PropFindMethod query; try { - query = new PropFindMethod(getUri().toString()); + Log.e("ASD", getUri().toString()); + query = new PropFindMethod(getUri().toString()+"/"); getClient().executeMethod(query); MultiStatus resp = null; resp = query.getResponseBodyAsMultiStatus(); + if (resp.getResponses().length > 0) { WebdavEntry we = new WebdavEntry(resp.getResponses()[0]); OCFile file = fillOCFile(we); file.setParentId(0); getStorageManager().saveFile(file); - Log.d(TAG, file.getPath() + " " + file.getFileId()); fetchData(getUri().toString(), syncResult, file.getFileId()); } } catch (OperationCanceledException e) { @@ -87,7 +95,8 @@ public class FileSyncAdapter extends AbstractOwnCloudSyncAdapter { syncResult.stats.numIoExceptions++; e.printStackTrace(); } - + i.putExtra(FileSyncService.IN_PROGRESS, false); + getContext().sendStickyBroadcast(i); } private void fetchData(String uri, SyncResult syncResult, long parentId) {