\r
import com.owncloud.android.authenticator.AccountAuthenticator;\r
import com.owncloud.android.db.ProviderMeta.ProviderTableMeta;\r
-import com.owncloud.android.files.interfaces.OnDatatransferProgressListener;\r
+import eu.alefzero.webdav.OnDatatransferProgressListener;\r
+\r
+import com.owncloud.android.network.OwnCloudClientUtils;\r
\r
import android.accounts.Account;\r
import android.accounts.AccountManager;\r
boolean downloadResult = false;\r
\r
/// prepare client object to send the request to the ownCloud server\r
- AccountManager am = (AccountManager) getSystemService(ACCOUNT_SERVICE);\r
- WebdavClient wdc = new WebdavClient(mAccount, getApplicationContext());\r
- String username = mAccount.name.split("@")[0];\r
- String password = null;\r
- try {\r
- password = am.blockingGetAuthToken(mAccount,\r
- AccountAuthenticator.AUTH_TOKEN_TYPE, true);\r
- } catch (Exception e) {\r
- Log.e(TAG, "Access to account credentials failed", e);\r
- sendFinalBroadcast(downloadResult, null);\r
- return;\r
- }\r
- wdc.setCredentials(username, password);\r
- wdc.allowSelfsignedCertificates();\r
+ WebdavClient wdc = OwnCloudClientUtils.createOwnCloudClient(mAccount, getApplicationContext());\r
wdc.setDataTransferProgressListener(this);\r
-\r
\r
/// download will be in a temporal file\r
File tmpFile = new File(getTemporalPath(mAccount.name) + mFilePath);\r