public VCardBuilder appendNameProperties(final List<ContentValues> contentValuesList){
  if (VCardConfig.isVersion40(mVCardType)) {
    return appendNamePropertiesV40(contentValuesList);
  }
  if (contentValuesList == null || contentValuesList.isEmpty()) {
    if (VCardConfig.isVersion30(mVCardType)) {
      appendLine(VCardConstants.PROPERTY_N,"");
      appendLine(VCardConstants.PROPERTY_FN,"");
    }
 else     if (mIsDoCoMo) {
      appendLine(VCardConstants.PROPERTY_N,"");
    }
    return this;
  }
  final ContentValues contentValues=getPrimaryContentValueWithStructuredName(contentValuesList);
  final String familyName=contentValues.getAsString(StructuredName.FAMILY_NAME);
  final String middleName=contentValues.getAsString(StructuredName.MIDDLE_NAME);
  final String givenName=contentValues.getAsString(StructuredName.GIVEN_NAME);
  final String prefix=contentValues.getAsString(StructuredName.PREFIX);
  final String suffix=contentValues.getAsString(StructuredName.SUFFIX);
  final String displayName=contentValues.getAsString(StructuredName.DISPLAY_NAME);
  if (!TextUtils.isEmpty(familyName) || !TextUtils.isEmpty(givenName)) {
    final boolean reallyAppendCharsetParameterToName=shouldAppendCharsetParam(familyName,givenName,middleName,prefix,suffix);
    final boolean reallyUseQuotedPrintableToName=(!mRefrainsQPToNameProperties && !(VCardUtils.containsOnlyNonCrLfPrintableAscii(familyName) && VCardUtils.containsOnlyNonCrLfPrintableAscii(givenName) && VCardUtils.containsOnlyNonCrLfPrintableAscii(middleName)&& VCardUtils.containsOnlyNonCrLfPrintableAscii(prefix)&& VCardUtils.containsOnlyNonCrLfPrintableAscii(suffix)));
    final String formattedName;
    if (!TextUtils.isEmpty(displayName)) {
      formattedName=displayName;
    }
 else {
      formattedName=VCardUtils.constructNameFromElements(VCardConfig.getNameOrderType(mVCardType),familyName,middleName,givenName,prefix,suffix);
    }
    final boolean reallyAppendCharsetParameterToFN=shouldAppendCharsetParam(formattedName);
    final boolean reallyUseQuotedPrintableToFN=!mRefrainsQPToNameProperties && !VCardUtils.containsOnlyNonCrLfPrintableAscii(formattedName);
    final String encodedFamily;
    final String encodedGiven;
    final String encodedMiddle;
    final String encodedPrefix;
    final String encodedSuffix;
    if (reallyUseQuotedPrintableToName) {
      encodedFamily=encodeQuotedPrintable(familyName);
      encodedGiven=encodeQuotedPrintable(givenName);
      encodedMiddle=encodeQuotedPrintable(middleName);
      encodedPrefix=encodeQuotedPrintable(prefix);
      encodedSuffix=encodeQuotedPrintable(suffix);
    }
 else {
      encodedFamily=escapeCharacters(familyName);
      encodedGiven=escapeCharacters(givenName);
      encodedMiddle=escapeCharacters(middleName);
      encodedPrefix=escapeCharacters(prefix);
      encodedSuffix=escapeCharacters(suffix);
    }
    final String encodedFormattedname=(reallyUseQuotedPrintableToFN ? encodeQuotedPrintable(formattedName) : escapeCharacters(formattedName));
    mBuilder.append(VCardConstants.PROPERTY_N);
    if (mIsDoCoMo) {
      if (reallyAppendCharsetParameterToName) {
        mBuilder.append(VCARD_PARAM_SEPARATOR);
        mBuilder.append(mVCardCharsetParameter);
      }
      if (reallyUseQuotedPrintableToName) {
        mBuilder.append(VCARD_PARAM_SEPARATOR);
        mBuilder.append(VCARD_PARAM_ENCODING_QP);
      }
      mBuilder.append(VCARD_DATA_SEPARATOR);
      mBuilder.append(formattedName);
      mBuilder.append(VCARD_ITEM_SEPARATOR);
      mBuilder.append(VCARD_ITEM_SEPARATOR);
      mBuilder.append(VCARD_ITEM_SEPARATOR);
      mBuilder.append(VCARD_ITEM_SEPARATOR);
    }
 else {
      if (reallyAppendCharsetParameterToName) {
        mBuilder.append(VCARD_PARAM_SEPARATOR);
        mBuilder.append(mVCardCharsetParameter);
      }
      if (reallyUseQuotedPrintableToName) {
        mBuilder.append(VCARD_PARAM_SEPARATOR);
        mBuilder.append(VCARD_PARAM_ENCODING_QP);
      }
      mBuilder.append(VCARD_DATA_SEPARATOR);
      mBuilder.append(encodedFamily);
      mBuilder.append(VCARD_ITEM_SEPARATOR);
      mBuilder.append(encodedGiven);
      mBuilder.append(VCARD_ITEM_SEPARATOR);
      mBuilder.append(encodedMiddle);
      mBuilder.append(VCARD_ITEM_SEPARATOR);
      mBuilder.append(encodedPrefix);
      mBuilder.append(VCARD_ITEM_SEPARATOR);
      mBuilder.append(encodedSuffix);
    }
    mBuilder.append(VCARD_END_OF_LINE);
    mBuilder.append(VCardConstants.PROPERTY_FN);
    if (reallyAppendCharsetParameterToFN) {
      mBuilder.append(VCARD_PARAM_SEPARATOR);
      mBuilder.append(mVCardCharsetParameter);
    }
    if (reallyUseQuotedPrintableToFN) {
      mBuilder.append(VCARD_PARAM_SEPARATOR);
      mBuilder.append(VCARD_PARAM_ENCODING_QP);
    }
    mBuilder.append(VCARD_DATA_SEPARATOR);
    mBuilder.append(encodedFormattedname);
    mBuilder.append(VCARD_END_OF_LINE);
  }
 else   if (!TextUtils.isEmpty(displayName)) {
    buildSinglePartNameField(VCardConstants.PROPERTY_N,displayName);
    mBuilder.append(VCARD_ITEM_SEPARATOR);
    mBuilder.append(VCARD_ITEM_SEPARATOR);
    mBuilder.append(VCARD_ITEM_SEPARATOR);
    mBuilder.append(VCARD_ITEM_SEPARATOR);
    mBuilder.append(VCARD_END_OF_LINE);
    buildSinglePartNameField(VCardConstants.PROPERTY_FN,displayName);
    mBuilder.append(VCARD_END_OF_LINE);
  }
 else   if (VCardConfig.isVersion30(mVCardType)) {
    appendLine(VCardConstants.PROPERTY_N,"");
    appendLine(VCardConstants.PROPERTY_FN,"");
  }
 else   if (mIsDoCoMo) {
    appendLine(VCardConstants.PROPERTY_N,"");
  }
  appendPhoneticNameFields(contentValues);
  return this;
}

public VCardBuilder appendNameProperties ( final List < ContentValues > contentValuesList ) { if ( VCardConfig . isVersion40 ( mVCardType ) ) { return appendNamePropertiesV40 ( contentValuesList ) ; } if ( contentValuesList == null || contentValuesList . isEmpty ( ) ) { if ( VCardConfig . isVersion30 ( mVCardType ) ) { appendLine ( VCardConstants . PROPERTY_N , "" ) ; appendLine ( VCardConstants . PROPERTY_FN , "" ) ; } else if ( mIsDoCoMo ) { appendLine ( VCardConstants . PROPERTY_N , "" ) ; } return this ; } final ContentValues contentValues = getPrimaryContentValueWithStructuredName ( contentValuesList ) ; final String familyName = contentValues . getAsString ( StructuredName . FAMILY_NAME ) ; final String middleName = contentValues . getAsString ( StructuredName . MIDDLE_NAME ) ; final String givenName = contentValues . getAsString ( StructuredName . GIVEN_NAME ) ; final String prefix = contentValues . getAsString ( StructuredName . PREFIX ) ; final String suffix = contentValues . getAsString ( StructuredName . SUFFIX ) ; final String displayName = contentValues . getAsString ( StructuredName . DISPLAY_NAME ) ; if ( ! TextUtils . isEmpty ( familyName ) || ! TextUtils . isEmpty ( givenName ) ) { final boolean reallyAppendCharsetParameterToName = shouldAppendCharsetParam ( familyName , givenName , middleName , prefix , suffix ) ; final boolean reallyUseQuotedPrintableToName = ( ! mRefrainsQPToNameProperties && ! ( VCardUtils . containsOnlyNonCrLfPrintableAscii ( familyName ) && VCardUtils . containsOnlyNonCrLfPrintableAscii ( givenName ) && VCardUtils . containsOnlyNonCrLfPrintableAscii ( middleName ) && VCardUtils . containsOnlyNonCrLfPrintableAscii ( prefix ) && VCardUtils . containsOnlyNonCrLfPrintableAscii ( suffix ) ) ) ; final String formattedName ; if ( ! TextUtils . isEmpty ( displayName ) ) { formattedName = displayName ; } else { formattedName = VCardUtils . constructNameFromElements ( VCardConfig . getNameOrderType ( mVCardType ) , familyName , middleName , givenName , prefix , suffix ) ; } final boolean reallyAppendCharsetParameterToFN = shouldAppendCharsetParam ( formattedName ) ; final boolean reallyUseQuotedPrintableToFN = ! mRefrainsQPToNameProperties && ! VCardUtils . containsOnlyNonCrLfPrintableAscii ( formattedName ) ; final String encodedFamily ; final String encodedGiven ; final String encodedMiddle ; final String encodedPrefix ; final String encodedSuffix ; if ( reallyUseQuotedPrintableToName ) { encodedFamily = encodeQuotedPrintable ( familyName ) ; encodedGiven = encodeQuotedPrintable ( givenName ) ; encodedMiddle = encodeQuotedPrintable ( middleName ) ; encodedPrefix = encodeQuotedPrintable ( prefix ) ; encodedSuffix = encodeQuotedPrintable ( suffix ) ; } else { encodedFamily = escapeCharacters ( familyName ) ; encodedGiven = escapeCharacters ( givenName ) ; encodedMiddle = escapeCharacters ( middleName ) ; encodedPrefix = escapeCharacters ( prefix ) ; encodedSuffix = escapeCharacters ( suffix ) ; } final String encodedFormattedname = ( reallyUseQuotedPrintableToFN ? encodeQuotedPrintable ( formattedName ) : escapeCharacters ( formattedName ) ) ; mBuilder . append ( VCardConstants . PROPERTY_N ) ; if ( mIsDoCoMo ) { if ( reallyAppendCharsetParameterToName ) { mBuilder . append ( VCARD_PARAM_SEPARATOR ) ; mBuilder . append ( mVCardCharsetParameter ) ; } if ( reallyUseQuotedPrintableToName ) { mBuilder . append ( VCARD_PARAM_SEPARATOR ) ; mBuilder . append ( VCARD_PARAM_ENCODING_QP ) ; } mBuilder . append ( VCARD_DATA_SEPARATOR ) ; mBuilder . append ( formattedName ) ; mBuilder . append ( VCARD_ITEM_SEPARATOR ) ; mBuilder . append ( VCARD_ITEM_SEPARATOR ) ; mBuilder . append ( VCARD_ITEM_SEPARATOR ) ; mBuilder . append ( VCARD_ITEM_SEPARATOR ) ; } else { if ( reallyAppendCharsetParameterToName ) { mBuilder . append ( VCARD_PARAM_SEPARATOR ) ; mBuilder . append ( mVCardCharsetParameter ) ; } if ( reallyUseQuotedPrintableToName ) { mBuilder . append ( VCARD_PARAM_SEPARATOR ) ; mBuilder . append ( VCARD_PARAM_ENCODING_QP ) ; } mBuilder . append ( VCARD_DATA_SEPARATOR ) ; mBuilder . append ( encodedFamily ) ; mBuilder . append ( VCARD_ITEM_SEPARATOR ) ; mBuilder . append ( encodedGiven ) ; mBuilder . append ( VCARD_ITEM_SEPARATOR ) ; mBuilder . append ( encodedMiddle ) ; mBuilder . append ( VCARD_ITEM_SEPARATOR ) ; mBuilder . append ( encodedPrefix ) ; mBuilder . append ( VCARD_ITEM_SEPARATOR ) ; mBuilder . append ( encodedSuffix ) ; } mBuilder . append ( VCARD_END_OF_LINE ) ; mBuilder . append ( VCardConstants . PROPERTY_FN ) ; if ( reallyAppendCharsetParameterToFN ) { mBuilder . append ( VCARD_PARAM_SEPARATOR ) ; mBuilder . append ( mVCardCharsetParameter ) ; } if ( reallyUseQuotedPrintableToFN ) { mBuilder . append ( VCARD_PARAM_SEPARATOR ) ; mBuilder . append ( VCARD_PARAM_ENCODING_QP ) ; } mBuilder . append ( VCARD_DATA_SEPARATOR ) ; mBuilder . append ( encodedFormattedname ) ; mBuilder . append ( VCARD_END_OF_LINE ) ; } else if ( ! TextUtils . isEmpty ( displayName ) ) { buildSinglePartNameField ( VCardConstants . PROPERTY_N , displayName ) ; mBuilder . append ( VCARD_ITEM_SEPARATOR ) ; mBuilder . append ( VCARD_ITEM_SEPARATOR ) ; mBuilder . append ( VCARD_ITEM_SEPARATOR ) ; mBuilder . append ( VCARD_ITEM_SEPARATOR ) ; mBuilder . append ( VCARD_END_OF_LINE ) ; buildSinglePartNameField ( VCardConstants . PROPERTY_FN , displayName ) ; mBuilder . append ( VCARD_END_OF_LINE ) ; } else if ( VCardConfig . isVersion30 ( mVCardType ) ) { appendLine ( VCardConstants . PROPERTY_N , "" ) ; appendLine ( VCardConstants . PROPERTY_FN , "" ) ; } else if ( mIsDoCoMo ) { appendLine ( VCardConstants . PROPERTY_N , "" ) ; } appendPhoneticNameFields ( contentValues ) ; return this ; }
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 .
