@Override
public String[] encode(Iterable<String> names,
String organization,
Iterable<String> addresses,
Iterable<String> phones,
Iterable<String> emails,
Iterable<String> urls,
String note) {
StringBuilder newContents = new StringBuilder(100);
newContents.append("BEGIN:VCARD").append(TERMINATOR);
newContents.append("VERSION:3.0").append(TERMINATOR);
StringBuilder newDisplayContents = new StringBuilder(100);
appendUpToUnique(newContents, newDisplayContents, "N", names, 1, null);
append(newContents, newDisplayContents, "ORG", organization);
appendUpToUnique(newContents, newDisplayContents, "ADR", addresses, 1, null);
appendUpToUnique(newContents, newDisplayContents, "TEL", phones, Integer.MAX_VALUE, new Formatter() {
@Override
public String format(String source) {
return PhoneNumberUtils.formatNumber(source);
}
});
appendUpToUnique(newContents, newDisplayContents, "EMAIL", emails, Integer.MAX_VALUE, null);
appendUpToUnique(newContents, newDisplayContents, "URL", urls, Integer.MAX_VALUE, null);
append(newContents, newDisplayContents, "NOTE", note);
newContents.append("END:VCARD").append(TERMINATOR);
return new String[] { newContents.toString(), newDisplayContents.toString() };
}
VCardContactEncoder.java 文件源码
java
阅读 22
收藏 0
点赞 0
评论 0
项目:keepass2android
作者:
评论列表
文章目录