/** * Method for deferred load of account attributes from AccountManager * * @param context * @throws AccountNotFoundException * @throws AuthenticatorException * @throws IOException * @throws OperationCanceledException */ public void loadCredentials(Context context) throws AuthenticatorException, IOException, OperationCanceledException { if (context == null) { throw new IllegalArgumentException("Parameter 'context' cannot be null"); } if (mSavedAccount != null) { mCredentials = AccountUtils.getCredentialsForAccount(context, mSavedAccount); } }
/** * Method for deferred load of account attributes from AccountManager * * @param context * @throws AuthenticatorException * @throws IOException * @throws OperationCanceledException */ public void loadCredentials(Context context) throws AuthenticatorException, IOException, OperationCanceledException { if (context == null) { throw new IllegalArgumentException("Parameter 'context' cannot be null"); } if (mSavedAccount != null) { mCredentials = AccountUtils.getCredentialsForAccount(context, mSavedAccount); } }
/** * Constructs full url to host and webdav resource basing on host version * * @param context Valid Android {@link Context}, needed to access the {@link AccountManager} * @param account A stored ownCloud {@link Account} * @return Full URL to WebDAV endpoint in the server corresponding to 'account'. * @throws AccountNotFoundException When 'account' is unknown for the AccountManager */ public static String getWebDavUrlForAccount(Context context, Account account) throws AccountNotFoundException { String webDavUrlForAccount = ""; try { OwnCloudCredentials ownCloudCredentials = getCredentialsForAccount(context, account); webDavUrlForAccount = getBaseUrlForAccount(context, account) + OwnCloudClient.WEBDAV_FILES_PATH_4_0 + ownCloudCredentials.getUsername(); } catch (OperationCanceledException e) { e.printStackTrace(); } catch (AuthenticatorException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return webDavUrlForAccount; }