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