/** * 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; }
@Override public GeneratedMessageLite respond(Wire.Envelope envelope) throws InvalidProtocolBufferException { Wire.DoAddAccountMenuRequest request = Wire.DoAddAccountMenuRequest.parseFrom(envelope.getMessage()); try { showAddAccountMenu(); } catch (AuthenticatorException e) { e.printStackTrace(); } catch (OperationCanceledException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return Wire.Envelope.newBuilder() .setId(envelope.getId()) .setType(Wire.MessageType.DO_ADD_ACCOUNT_MENU) .setMessage(Wire.DoAddAccountMenuResponse.newBuilder() .setSuccess(true) .build() .toByteString()) .build(); }
successResult = success.getResult(); } catch (OperationCanceledException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace();