X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/fbd720e8874d5adcfd0dcc5aa8c602ecb54ef83c..8e36e7cc3e6218ccb80ee2af3eb0a19df24e339f:/src/com/owncloud/android/AccountUtils.java diff --git a/src/com/owncloud/android/AccountUtils.java b/src/com/owncloud/android/AccountUtils.java index 49b0a62d..f38b2e70 100644 --- a/src/com/owncloud/android/AccountUtils.java +++ b/src/com/owncloud/android/AccountUtils.java @@ -1,9 +1,10 @@ /* ownCloud Android client application * Copyright (C) 2012 Bartek Przybylski + * Copyright (C) 2012-2013 ownCloud Inc. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or + * the Free Software Foundation, either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, @@ -107,5 +108,27 @@ public class AccountUtils { } return null; } + + /** + * Constructs full url to host and webdav resource basing on host version + * @param context + * @param account + * @return url or null on failure + */ + public static String constructFullURLForAccount(Context context, Account account) { + try { + AccountManager ama = AccountManager.get(context); + String baseurl = ama.getUserData(account, AccountAuthenticator.KEY_OC_BASE_URL); + String strver = ama.getUserData(account, AccountAuthenticator.KEY_OC_VERSION); + OwnCloudVersion ver = new OwnCloudVersion(strver); + String webdavpath = getWebdavPath(ver); + + if (webdavpath == null) return null; + return baseurl + webdavpath; + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } }