public class VCardBuilder extends Object
The class which lets users create their own vCard String. Typical usage is as follows:
final VCardBuilder builder = new VCardBuilder(vcardType); builder.appendNameProperties(contentValuesListMap.get(StructuredName.CONTENT_ITEM_TYPE)) .appendNickNames(contentValuesListMap.get(Nickname.CONTENT_ITEM_TYPE)) .appendPhones(contentValuesListMap.get(Phone.CONTENT_ITEM_TYPE)) .appendEmails(contentValuesListMap.get(Email.CONTENT_ITEM_TYPE)) .appendPostals(contentValuesListMap.get(StructuredPostal.CONTENT_ITEM_TYPE)) .appendOrganizations(contentValuesListMap.get(Organization.CONTENT_ITEM_TYPE)) .appendWebsites(contentValuesListMap.get(Website.CONTENT_ITEM_TYPE)) .appendPhotos(contentValuesListMap.get(Photo.CONTENT_ITEM_TYPE)) .appendNotes(contentValuesListMap.get(Note.CONTENT_ITEM_TYPE)) .appendEvents(contentValuesListMap.get(Event.CONTENT_ITEM_TYPE)) .appendIms(contentValuesListMap.get(Im.CONTENT_ITEM_TYPE)) .appendRelation(contentValuesListMap.get(Relation.CONTENT_ITEM_TYPE)); return builder.toString();
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_EMAIL_TYPE |
static int |
DEFAULT_PHONE_TYPE |
static int |
DEFAULT_POSTAL_TYPE |
static String |
VCARD_END_OF_LINE |
Constructor and Description |
---|
VCardBuilder(int vcardType) |
VCardBuilder(int vcardType,
String charset) |
Modifier and Type | Method and Description |
---|---|
void |
appendAndroidSpecificProperty(String mimeType,
ContentValues contentValues) |
void |
appendEmailLine(int type,
String label,
String rawValue,
boolean isPrimary) |
VCardBuilder |
appendEmails(List<ContentValues> contentValuesList) |
VCardBuilder |
appendEvents(List<ContentValues> contentValuesList) |
VCardBuilder |
appendIms(List<ContentValues> contentValuesList) |
void |
appendLine(String propertyName,
List<String> rawValueList) |
void |
appendLine(String propertyName,
List<String> rawValueList,
boolean needCharset,
boolean needQuotedPrintable) |
void |
appendLine(String propertyName,
List<String> parameterList,
List<String> rawValueList,
boolean needCharset,
boolean needQuotedPrintable) |
void |
appendLine(String propertyName,
List<String> parameterList,
String rawValue) |
void |
appendLine(String propertyName,
List<String> parameterList,
String rawValue,
boolean needCharset,
boolean reallyUseQuotedPrintable) |
void |
appendLine(String propertyName,
String rawValue)
Appends one line with a given property name and value.
|
void |
appendLine(String propertyName,
String rawValue,
boolean needCharset,
boolean reallyUseQuotedPrintable) |
void |
appendLineWithCharsetAndQPDetection(String propertyName,
List<String> rawValueList) |
void |
appendLineWithCharsetAndQPDetection(String propertyName,
List<String> parameterList,
List<String> rawValueList) |
void |
appendLineWithCharsetAndQPDetection(String propertyName,
List<String> parameterList,
String rawValue) |
void |
appendLineWithCharsetAndQPDetection(String propertyName,
String rawValue) |
VCardBuilder |
appendNameProperties(List<ContentValues> contentValuesList)
For safety, we'll emit just one value around StructuredName, as external importers
may get confused with multiple "N", "FN", etc. properties, though it is valid in
vCard spec.
|
VCardBuilder |
appendNickNames(List<ContentValues> contentValuesList) |
VCardBuilder |
appendNotes(List<ContentValues> contentValuesList) |
VCardBuilder |
appendOrganizations(List<ContentValues> contentValuesList) |
VCardBuilder |
appendPhones(List<ContentValues> contentValuesList,
VCardPhoneNumberTranslationCallback translationCallback) |
void |
appendPhotoLine(String encodedValue,
String photoType) |
VCardBuilder |
appendPhotos(List<ContentValues> contentValuesList) |
void |
appendPostalLine(int type,
String label,
ContentValues contentValues,
boolean isPrimary,
boolean emitEveryTime) |
VCardBuilder |
appendPostals(List<ContentValues> contentValuesList) |
VCardBuilder |
appendRelation(List<ContentValues> contentValuesList) |
VCardBuilder |
appendSipAddresses(List<ContentValues> contentValuesList)
SIP (Session Initiation Protocol) is first supported in RFC 4770 as part of IMPP
support. vCard 2.1 and old vCard 3.0 may not able to parse it, or expect X-SIP
instead of "IMPP;sip:...".
|
void |
appendTelLine(Integer typeAsInteger,
String label,
String encodedValue,
boolean isPrimary) |
VCardBuilder |
appendWebsites(List<ContentValues> contentValuesList) |
void |
clear() |
String |
toString()
Returns a string representation of the object.
|
public static final int DEFAULT_PHONE_TYPE
public static final int DEFAULT_POSTAL_TYPE
public static final int DEFAULT_EMAIL_TYPE
public static final String VCARD_END_OF_LINE
public VCardBuilder(int vcardType)
public VCardBuilder(int vcardType, String charset)
vcardType
- charset
- If null, we use default charset for export.public void clear()
public VCardBuilder appendNameProperties(List<ContentValues> contentValuesList)
public VCardBuilder appendNickNames(List<ContentValues> contentValuesList)
public VCardBuilder appendPhones(List<ContentValues> contentValuesList, VCardPhoneNumberTranslationCallback translationCallback)
public VCardBuilder appendEmails(List<ContentValues> contentValuesList)
public VCardBuilder appendPostals(List<ContentValues> contentValuesList)
public VCardBuilder appendIms(List<ContentValues> contentValuesList)
public VCardBuilder appendWebsites(List<ContentValues> contentValuesList)
public VCardBuilder appendOrganizations(List<ContentValues> contentValuesList)
public VCardBuilder appendPhotos(List<ContentValues> contentValuesList)
public VCardBuilder appendNotes(List<ContentValues> contentValuesList)
public VCardBuilder appendEvents(List<ContentValues> contentValuesList)
public VCardBuilder appendRelation(List<ContentValues> contentValuesList)
public void appendPostalLine(int type, String label, ContentValues contentValues, boolean isPrimary, boolean emitEveryTime)
emitEveryTime
- If true, builder builds the line even when there's no entry.public void appendEmailLine(int type, String label, String rawValue, boolean isPrimary)
public void appendTelLine(Integer typeAsInteger, String label, String encodedValue, boolean isPrimary)
public void appendPhotoLine(String encodedValue, String photoType)
encodedValue
- Must be encoded by BASE64photoType
- public VCardBuilder appendSipAddresses(List<ContentValues> contentValuesList)
public void appendAndroidSpecificProperty(String mimeType, ContentValues contentValues)
public void appendLineWithCharsetAndQPDetection(String propertyName, String rawValue)
public void appendLineWithCharsetAndQPDetection(String propertyName, List<String> rawValueList)
public void appendLineWithCharsetAndQPDetection(String propertyName, List<String> parameterList, String rawValue)
public void appendLineWithCharsetAndQPDetection(String propertyName, List<String> parameterList, List<String> rawValueList)
public void appendLine(String propertyName, String rawValue)
public void appendLine(String propertyName, String rawValue, boolean needCharset, boolean reallyUseQuotedPrintable)
public void appendLine(String propertyName, List<String> parameterList, String rawValue, boolean needCharset, boolean reallyUseQuotedPrintable)
public void appendLine(String propertyName, List<String> rawValueList, boolean needCharset, boolean needQuotedPrintable)
public void appendLine(String propertyName, List<String> parameterList, List<String> rawValueList, boolean needCharset, boolean needQuotedPrintable)
public String toString()
Object
toString
method returns a string that
"textually represents" this object. The result should
be a concise but informative representation that is easy for a
person to read.
It is recommended that all subclasses override this method.
The toString
method for class Object
returns a string consisting of the name of the class of which the
object is an instance, the at-sign character `@
', and
the unsigned hexadecimal representation of the hash code of the
object. In other words, this method returns a string equal to the
value of:
getClass().getName() + '@' + Integer.toHexString(hashCode())