private void appendPhoneticNameFields(final ContentValues contentValues){
  final String phoneticFamilyName;
  final String phoneticMiddleName;
  final String phoneticGivenName;
{
    final String tmpPhoneticFamilyName=contentValues.getAsString(StructuredName.PHONETIC_FAMILY_NAME);
    final String tmpPhoneticMiddleName=contentValues.getAsString(StructuredName.PHONETIC_MIDDLE_NAME);
    final String tmpPhoneticGivenName=contentValues.getAsString(StructuredName.PHONETIC_GIVEN_NAME);
    if (mNeedsToConvertPhoneticString) {
      phoneticFamilyName=VCardUtils.toHalfWidthString(tmpPhoneticFamilyName);
      phoneticMiddleName=VCardUtils.toHalfWidthString(tmpPhoneticMiddleName);
      phoneticGivenName=VCardUtils.toHalfWidthString(tmpPhoneticGivenName);
    }
 else {
      phoneticFamilyName=tmpPhoneticFamilyName;
      phoneticMiddleName=tmpPhoneticMiddleName;
      phoneticGivenName=tmpPhoneticGivenName;
    }
  }
  if (TextUtils.isEmpty(phoneticFamilyName) && TextUtils.isEmpty(phoneticMiddleName) && TextUtils.isEmpty(phoneticGivenName)) {
    if (mIsDoCoMo) {
      mBuilder.append(VCardConstants.PROPERTY_SOUND);
      mBuilder.append(VCARD_PARAM_SEPARATOR);
      mBuilder.append(VCardConstants.PARAM_TYPE_X_IRMC_N);
      mBuilder.append(VCARD_DATA_SEPARATOR);
      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);
    }
    return;
  }
  if (VCardConfig.isVersion40(mVCardType)) {
  }
 else   if (VCardConfig.isVersion30(mVCardType)) {
    final String sortString=VCardUtils.constructNameFromElements(mVCardType,phoneticFamilyName,phoneticMiddleName,phoneticGivenName);
    mBuilder.append(VCardConstants.PROPERTY_SORT_STRING);
    if (VCardConfig.isVersion30(mVCardType) && shouldAppendCharsetParam(sortString)) {
      mBuilder.append(VCARD_PARAM_SEPARATOR);
      mBuilder.append(mVCardCharsetParameter);
    }
    mBuilder.append(VCARD_DATA_SEPARATOR);
    mBuilder.append(escapeCharacters(sortString));
    mBuilder.append(VCARD_END_OF_LINE);
  }
 else   if (mIsJapaneseMobilePhone) {
    mBuilder.append(VCardConstants.PROPERTY_SOUND);
    mBuilder.append(VCARD_PARAM_SEPARATOR);
    mBuilder.append(VCardConstants.PARAM_TYPE_X_IRMC_N);
    boolean reallyUseQuotedPrintable=(!mRefrainsQPToNameProperties && !(VCardUtils.containsOnlyNonCrLfPrintableAscii(phoneticFamilyName) && VCardUtils.containsOnlyNonCrLfPrintableAscii(phoneticMiddleName) && VCardUtils.containsOnlyNonCrLfPrintableAscii(phoneticGivenName)));
    final String encodedPhoneticFamilyName;
    final String encodedPhoneticMiddleName;
    final String encodedPhoneticGivenName;
    if (reallyUseQuotedPrintable) {
      encodedPhoneticFamilyName=encodeQuotedPrintable(phoneticFamilyName);
      encodedPhoneticMiddleName=encodeQuotedPrintable(phoneticMiddleName);
      encodedPhoneticGivenName=encodeQuotedPrintable(phoneticGivenName);
    }
 else {
      encodedPhoneticFamilyName=escapeCharacters(phoneticFamilyName);
      encodedPhoneticMiddleName=escapeCharacters(phoneticMiddleName);
      encodedPhoneticGivenName=escapeCharacters(phoneticGivenName);
    }
    if (shouldAppendCharsetParam(encodedPhoneticFamilyName,encodedPhoneticMiddleName,encodedPhoneticGivenName)) {
      mBuilder.append(VCARD_PARAM_SEPARATOR);
      mBuilder.append(mVCardCharsetParameter);
    }
    mBuilder.append(VCARD_DATA_SEPARATOR);
{
      boolean first=true;
      if (!TextUtils.isEmpty(encodedPhoneticFamilyName)) {
        mBuilder.append(encodedPhoneticFamilyName);
        first=false;
      }
      if (!TextUtils.isEmpty(encodedPhoneticMiddleName)) {
        if (first) {
          first=false;
        }
 else {
          mBuilder.append(' ');
        }
        mBuilder.append(encodedPhoneticMiddleName);
      }
      if (!TextUtils.isEmpty(encodedPhoneticGivenName)) {
        if (!first) {
          mBuilder.append(' ');
        }
        mBuilder.append(encodedPhoneticGivenName);
      }
    }
    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);
  }
  if (mUsesDefactProperty) {
    if (!TextUtils.isEmpty(phoneticGivenName)) {
      final boolean reallyUseQuotedPrintable=(mShouldUseQuotedPrintable && !VCardUtils.containsOnlyNonCrLfPrintableAscii(phoneticGivenName));
      final String encodedPhoneticGivenName;
      if (reallyUseQuotedPrintable) {
        encodedPhoneticGivenName=encodeQuotedPrintable(phoneticGivenName);
      }
 else {
        encodedPhoneticGivenName=escapeCharacters(phoneticGivenName);
      }
      mBuilder.append(VCardConstants.PROPERTY_X_PHONETIC_FIRST_NAME);
      if (shouldAppendCharsetParam(phoneticGivenName)) {
        mBuilder.append(VCARD_PARAM_SEPARATOR);
        mBuilder.append(mVCardCharsetParameter);
      }
      if (reallyUseQuotedPrintable) {
        mBuilder.append(VCARD_PARAM_SEPARATOR);
        mBuilder.append(VCARD_PARAM_ENCODING_QP);
      }
      mBuilder.append(VCARD_DATA_SEPARATOR);
      mBuilder.append(encodedPhoneticGivenName);
      mBuilder.append(VCARD_END_OF_LINE);
    }
    if (!TextUtils.isEmpty(phoneticMiddleName)) {
      final boolean reallyUseQuotedPrintable=(mShouldUseQuotedPrintable && !VCardUtils.containsOnlyNonCrLfPrintableAscii(phoneticMiddleName));
      final String encodedPhoneticMiddleName;
      if (reallyUseQuotedPrintable) {
        encodedPhoneticMiddleName=encodeQuotedPrintable(phoneticMiddleName);
      }
 else {
        encodedPhoneticMiddleName=escapeCharacters(phoneticMiddleName);
      }
      mBuilder.append(VCardConstants.PROPERTY_X_PHONETIC_MIDDLE_NAME);
      if (shouldAppendCharsetParam(phoneticMiddleName)) {
        mBuilder.append(VCARD_PARAM_SEPARATOR);
        mBuilder.append(mVCardCharsetParameter);
      }
      if (reallyUseQuotedPrintable) {
        mBuilder.append(VCARD_PARAM_SEPARATOR);
        mBuilder.append(VCARD_PARAM_ENCODING_QP);
      }
      mBuilder.append(VCARD_DATA_SEPARATOR);
      mBuilder.append(encodedPhoneticMiddleName);
      mBuilder.append(VCARD_END_OF_LINE);
    }
    if (!TextUtils.isEmpty(phoneticFamilyName)) {
      final boolean reallyUseQuotedPrintable=(mShouldUseQuotedPrintable && !VCardUtils.containsOnlyNonCrLfPrintableAscii(phoneticFamilyName));
      final String encodedPhoneticFamilyName;
      if (reallyUseQuotedPrintable) {
        encodedPhoneticFamilyName=encodeQuotedPrintable(phoneticFamilyName);
      }
 else {
        encodedPhoneticFamilyName=escapeCharacters(phoneticFamilyName);
      }
      mBuilder.append(VCardConstants.PROPERTY_X_PHONETIC_LAST_NAME);
      if (shouldAppendCharsetParam(phoneticFamilyName)) {
        mBuilder.append(VCARD_PARAM_SEPARATOR);
        mBuilder.append(mVCardCharsetParameter);
      }
      if (reallyUseQuotedPrintable) {
        mBuilder.append(VCARD_PARAM_SEPARATOR);
        mBuilder.append(VCARD_PARAM_ENCODING_QP);
      }
      mBuilder.append(VCARD_DATA_SEPARATOR);
      mBuilder.append(encodedPhoneticFamilyName);
      mBuilder.append(VCARD_END_OF_LINE);
    }
  }
}

private void appendPhoneticNameFields ( final ContentValues contentValues ) { final String phoneticFamilyName ; final String phoneticMiddleName ; final String phoneticGivenName ; { final String tmpPhoneticFamilyName = contentValues . getAsString ( StructuredName . PHONETIC_FAMILY_NAME ) ; final String tmpPhoneticMiddleName = contentValues . getAsString ( StructuredName . PHONETIC_MIDDLE_NAME ) ; final String tmpPhoneticGivenName = contentValues . getAsString ( StructuredName . PHONETIC_GIVEN_NAME ) ; if ( mNeedsToConvertPhoneticString ) { phoneticFamilyName = VCardUtils . toHalfWidthString ( tmpPhoneticFamilyName ) ; phoneticMiddleName = VCardUtils . toHalfWidthString ( tmpPhoneticMiddleName ) ; phoneticGivenName = VCardUtils . toHalfWidthString ( tmpPhoneticGivenName ) ; } else { phoneticFamilyName = tmpPhoneticFamilyName ; phoneticMiddleName = tmpPhoneticMiddleName ; phoneticGivenName = tmpPhoneticGivenName ; } } if ( TextUtils . isEmpty ( phoneticFamilyName ) && TextUtils . isEmpty ( phoneticMiddleName ) && TextUtils . isEmpty ( phoneticGivenName ) ) { if ( mIsDoCoMo ) { mBuilder . append ( VCardConstants . PROPERTY_SOUND ) ; mBuilder . append ( VCARD_PARAM_SEPARATOR ) ; mBuilder . append ( VCardConstants . PARAM_TYPE_X_IRMC_N ) ; mBuilder . append ( VCARD_DATA_SEPARATOR ) ; 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 ) ; } return ; } if ( VCardConfig . isVersion40 ( mVCardType ) ) { } else if ( VCardConfig . isVersion30 ( mVCardType ) ) { final String sortString = VCardUtils . constructNameFromElements ( mVCardType , phoneticFamilyName , phoneticMiddleName , phoneticGivenName ) ; mBuilder . append ( VCardConstants . PROPERTY_SORT_STRING ) ; if ( VCardConfig . isVersion30 ( mVCardType ) && shouldAppendCharsetParam ( sortString ) ) { mBuilder . append ( VCARD_PARAM_SEPARATOR ) ; mBuilder . append ( mVCardCharsetParameter ) ; } mBuilder . append ( VCARD_DATA_SEPARATOR ) ; mBuilder . append ( escapeCharacters ( sortString ) ) ; mBuilder . append ( VCARD_END_OF_LINE ) ; } else if ( mIsJapaneseMobilePhone ) { mBuilder . append ( VCardConstants . PROPERTY_SOUND ) ; mBuilder . append ( VCARD_PARAM_SEPARATOR ) ; mBuilder . append ( VCardConstants . PARAM_TYPE_X_IRMC_N ) ; boolean reallyUseQuotedPrintable = ( ! mRefrainsQPToNameProperties && ! ( VCardUtils . containsOnlyNonCrLfPrintableAscii ( phoneticFamilyName ) && VCardUtils . containsOnlyNonCrLfPrintableAscii ( phoneticMiddleName ) && VCardUtils . containsOnlyNonCrLfPrintableAscii ( phoneticGivenName ) ) ) ; final String encodedPhoneticFamilyName ; final String encodedPhoneticMiddleName ; final String encodedPhoneticGivenName ; if ( reallyUseQuotedPrintable ) { encodedPhoneticFamilyName = encodeQuotedPrintable ( phoneticFamilyName ) ; encodedPhoneticMiddleName = encodeQuotedPrintable ( phoneticMiddleName ) ; encodedPhoneticGivenName = encodeQuotedPrintable ( phoneticGivenName ) ; } else { encodedPhoneticFamilyName = escapeCharacters ( phoneticFamilyName ) ; encodedPhoneticMiddleName = escapeCharacters ( phoneticMiddleName ) ; encodedPhoneticGivenName = escapeCharacters ( phoneticGivenName ) ; } if ( shouldAppendCharsetParam ( encodedPhoneticFamilyName , encodedPhoneticMiddleName , encodedPhoneticGivenName ) ) { mBuilder . append ( VCARD_PARAM_SEPARATOR ) ; mBuilder . append ( mVCardCharsetParameter ) ; } mBuilder . append ( VCARD_DATA_SEPARATOR ) ; { boolean first = true ; if ( ! TextUtils . isEmpty ( encodedPhoneticFamilyName ) ) { mBuilder . append ( encodedPhoneticFamilyName ) ; first = false ; } if ( ! TextUtils . isEmpty ( encodedPhoneticMiddleName ) ) { if ( first ) { first = false ; } else { mBuilder . append ( ' ' ) ; } mBuilder . append ( encodedPhoneticMiddleName ) ; } if ( ! TextUtils . isEmpty ( encodedPhoneticGivenName ) ) { if ( ! first ) { mBuilder . append ( ' ' ) ; } mBuilder . append ( encodedPhoneticGivenName ) ; } } 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 ) ; } if ( mUsesDefactProperty ) { if ( ! TextUtils . isEmpty ( phoneticGivenName ) ) { final boolean reallyUseQuotedPrintable = ( mShouldUseQuotedPrintable && ! VCardUtils . containsOnlyNonCrLfPrintableAscii ( phoneticGivenName ) ) ; final String encodedPhoneticGivenName ; if ( reallyUseQuotedPrintable ) { encodedPhoneticGivenName = encodeQuotedPrintable ( phoneticGivenName ) ; } else { encodedPhoneticGivenName = escapeCharacters ( phoneticGivenName ) ; } mBuilder . append ( VCardConstants . PROPERTY_X_PHONETIC_FIRST_NAME ) ; if ( shouldAppendCharsetParam ( phoneticGivenName ) ) { mBuilder . append ( VCARD_PARAM_SEPARATOR ) ; mBuilder . append ( mVCardCharsetParameter ) ; } if ( reallyUseQuotedPrintable ) { mBuilder . append ( VCARD_PARAM_SEPARATOR ) ; mBuilder . append ( VCARD_PARAM_ENCODING_QP ) ; } mBuilder . append ( VCARD_DATA_SEPARATOR ) ; mBuilder . append ( encodedPhoneticGivenName ) ; mBuilder . append ( VCARD_END_OF_LINE ) ; } if ( ! TextUtils . isEmpty ( phoneticMiddleName ) ) { final boolean reallyUseQuotedPrintable = ( mShouldUseQuotedPrintable && ! VCardUtils . containsOnlyNonCrLfPrintableAscii ( phoneticMiddleName ) ) ; final String encodedPhoneticMiddleName ; if ( reallyUseQuotedPrintable ) { encodedPhoneticMiddleName = encodeQuotedPrintable ( phoneticMiddleName ) ; } else { encodedPhoneticMiddleName = escapeCharacters ( phoneticMiddleName ) ; } mBuilder . append ( VCardConstants . PROPERTY_X_PHONETIC_MIDDLE_NAME ) ; if ( shouldAppendCharsetParam ( phoneticMiddleName ) ) { mBuilder . append ( VCARD_PARAM_SEPARATOR ) ; mBuilder . append ( mVCardCharsetParameter ) ; } if ( reallyUseQuotedPrintable ) { mBuilder . append ( VCARD_PARAM_SEPARATOR ) ; mBuilder . append ( VCARD_PARAM_ENCODING_QP ) ; } mBuilder . append ( VCARD_DATA_SEPARATOR ) ; mBuilder . append ( encodedPhoneticMiddleName ) ; mBuilder . append ( VCARD_END_OF_LINE ) ; } if ( ! TextUtils . isEmpty ( phoneticFamilyName ) ) { final boolean reallyUseQuotedPrintable = ( mShouldUseQuotedPrintable && ! VCardUtils . containsOnlyNonCrLfPrintableAscii ( phoneticFamilyName ) ) ; final String encodedPhoneticFamilyName ; if ( reallyUseQuotedPrintable ) { encodedPhoneticFamilyName = encodeQuotedPrintable ( phoneticFamilyName ) ; } else { encodedPhoneticFamilyName = escapeCharacters ( phoneticFamilyName ) ; } mBuilder . append ( VCardConstants . PROPERTY_X_PHONETIC_LAST_NAME ) ; if ( shouldAppendCharsetParam ( phoneticFamilyName ) ) { mBuilder . append ( VCARD_PARAM_SEPARATOR ) ; mBuilder . append ( mVCardCharsetParameter ) ; } if ( reallyUseQuotedPrintable ) { mBuilder . append ( VCARD_PARAM_SEPARATOR ) ; mBuilder . append ( VCARD_PARAM_ENCODING_QP ) ; } mBuilder . append ( VCARD_DATA_SEPARATOR ) ; mBuilder . append ( encodedPhoneticFamilyName ) ; mBuilder . append ( VCARD_END_OF_LINE ) ; } } }
emits sound ; irmc , sort - string , and de - fact values for phonetic names like x - phonetic - family .
