@Override public void addCollection(String remotePath, String displayName) { account.setCardDavCollection(context, remotePath); LocalContactCollection collection = new LocalContactCollection(context, client, account.getOsAccount(), remotePath); collection.setDisplayName(displayName); }
@Override public List<LocalContactCollection> getCollections() { List<LocalContactCollection> collections = new LinkedList<LocalContactCollection>(); Optional<String> collectionPath = account.getCardDavCollectionPath(context); if (collectionPath.isPresent()) collections.add( new LocalContactCollection( context, client, account.getOsAccount(), collectionPath.get())); return collections; }
@Override public Optional<LocalContactCollection> getCollection(String remotePath) throws RemoteException { Optional<String> collectionPath = account.getCardDavCollectionPath(context); String remotePathDecoded; try { remotePathDecoded = (URLDecoder.decode(remotePath, "UTF8")); } catch (UnsupportedEncodingException e) { Log.e(TAG, "caught exception while returning collection", e); throw new RemoteException(e.toString()); // HACK :( } if (collectionPath.isPresent() && (collectionPath.get().equals(remotePath) || collectionPath.get().equals(remotePathDecoded))) { return Optional.of( new LocalContactCollection( context, client, account.getOsAccount(), collectionPath.get())); } return Optional.absent(); }
@Override public void addCollection(String remotePath) { account.setCardDavCollection(context, remotePath); }
@Override public void removeCollection(String remotePath) { account.setCardDavCollection(context, null); }