X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/d95d2ac85680c0dcb8a2d863d809c40b64a5808d..afaa2879d192be067cae523b51dad75d89a6c6cb:/src/com/owncloud/android/syncadapter/AbstractOwnCloudSyncAdapter.java?ds=inline diff --git a/src/com/owncloud/android/syncadapter/AbstractOwnCloudSyncAdapter.java b/src/com/owncloud/android/syncadapter/AbstractOwnCloudSyncAdapter.java index a08a4bd4..47403100 100644 --- a/src/com/owncloud/android/syncadapter/AbstractOwnCloudSyncAdapter.java +++ b/src/com/owncloud/android/syncadapter/AbstractOwnCloudSyncAdapter.java @@ -1,6 +1,10 @@ -/* ownCloud Android client application +/** + * ownCloud Android client application + * + * @author sassman + * @author David A. Velasco * Copyright (C) 2011 Bartek Przybylski - * Copyright (C) 2012-2013 ownCloud Inc. + * Copyright (C) 2015 ownCloud Inc. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2, @@ -28,7 +32,9 @@ import com.owncloud.android.MainApp; import com.owncloud.android.datamodel.FileDataStorageManager; import com.owncloud.android.lib.common.accounts.AccountUtils; import com.owncloud.android.lib.common.accounts.AccountUtils.AccountNotFoundException; +import com.owncloud.android.lib.common.OwnCloudAccount; import com.owncloud.android.lib.common.OwnCloudClient; +import com.owncloud.android.lib.common.OwnCloudClientManagerFactory; import android.accounts.Account; import android.accounts.AccountManager; @@ -43,9 +49,6 @@ import android.content.Context; * resource types, like FileSync, ConcatsSync, CalendarSync, etc.. * * Implements the standard {@link AbstractThreadedSyncAdapter}. - * - * @author sassman - * @author David A. Velasco */ public abstract class AbstractOwnCloudSyncAdapter extends AbstractThreadedSyncAdapter { @@ -62,7 +65,8 @@ public abstract class AbstractOwnCloudSyncAdapter extends this.setAccountManager(AccountManager.get(context)); } - public AbstractOwnCloudSyncAdapter(Context context, boolean autoInitialize, boolean allowParallelSyncs) { + public AbstractOwnCloudSyncAdapter(Context context, boolean autoInitialize, + boolean allowParallelSyncs) { super(context, autoInitialize, allowParallelSyncs); this.setAccountManager(AccountManager.get(context)); } @@ -99,10 +103,12 @@ public abstract class AbstractOwnCloudSyncAdapter extends return mStoreManager; } - protected void initClientForCurrentAccount() throws OperationCanceledException, AuthenticatorException, IOException, AccountNotFoundException { + protected void initClientForCurrentAccount() throws OperationCanceledException, + AuthenticatorException, IOException, AccountNotFoundException { AccountUtils.constructFullURLForAccount(getContext(), account); - mClient = ((MainApp)(getContext().getApplicationContext())).getOwnCloudClientManager(). - getClientFor(account, getContext()); + OwnCloudAccount ocAccount = new OwnCloudAccount(account, getContext()); + mClient = OwnCloudClientManagerFactory.getDefaultSingleton(). + getClientFor(ocAccount, getContext()); } protected OwnCloudClient getClient() {