- public static synchronized WebdavClient getInstance(Account account, Context context){\r
- WebdavClient instance = clients.get(account.name);\r
- if(instance == null ){\r
- OwnCloudVersion ownCloudVersion = new OwnCloudVersion(AccountManager.get(context).getUserData(account,\r
- AccountAuthenticator.KEY_OC_VERSION));\r
- String baseUrl = AccountManager.get(context).getUserData(account, AccountAuthenticator.KEY_OC_BASE_URL);\r
- String webDavPath = AccountUtils.getWebdavPath(ownCloudVersion);\r
- WebdavClient client = new WebdavClient();\r
- \r
- String username = account.name.substring(0, account.name.indexOf('@'));\r
- String password = AccountManager.get(context).getPassword(account);\r
- \r
- client.mUri = Uri.parse(baseUrl + webDavPath);\r
- client.getParams().setParameter(HttpMethodParams.USER_AGENT, USER_AGENT);\r
- client.setCredentials(username, password);\r
- client.allowSelfsignedCertificates();\r
- clients.put(account.name, client);\r
- }\r
- return instance;\r
+ public WebdavClient (Account account, Context context){\r
+ OwnCloudVersion ownCloudVersion = new OwnCloudVersion(AccountManager.get(context).getUserData(account,\r
+ AccountAuthenticator.KEY_OC_VERSION));\r
+ String baseUrl = AccountManager.get(context).getUserData(account, AccountAuthenticator.KEY_OC_BASE_URL);\r
+ String webDavPath = AccountUtils.getWebdavPath(ownCloudVersion); \r
+ String username = account.name.substring(0, account.name.indexOf('@'));\r
+ String password = AccountManager.get(context).getPassword(account);\r
+ \r
+ mUri = Uri.parse(baseUrl + webDavPath);\r
+ getParams().setParameter(HttpMethodParams.USER_AGENT, USER_AGENT);\r
+ setCredentials(username, password);\r
+ allowSelfsignedCertificates();\r