diff options
| author | 2009-09-24 11:12:32 -0700 | |
|---|---|---|
| committer | 2009-09-24 13:11:20 -0700 | |
| commit | b55e60e1d88c02078c3d6bc0f408fb0065a1e93c (patch) | |
| tree | 833b2c05ecbd44e9986347d084e7311bd36050f6 | |
| parent | 43f9920271848c0ec84a958bfa06542c8fb7e4fa (diff) | |
Fix vCard code.
| -rw-r--r-- | core/java/android/pim/vcard/ContactStruct.java | 125 | ||||
| -rw-r--r-- | core/java/android/pim/vcard/VCardComposer.java | 12 |
2 files changed, 118 insertions, 19 deletions
diff --git a/core/java/android/pim/vcard/ContactStruct.java b/core/java/android/pim/vcard/ContactStruct.java index df0c834ccd9d..d7fc2d16a15a 100644 --- a/core/java/android/pim/vcard/ContactStruct.java +++ b/core/java/android/pim/vcard/ContactStruct.java @@ -477,44 +477,148 @@ public class ContactStruct { mPhotoList = photoList; mWebsiteList = websiteList; } + + // All getter methods should be used carefully, since they may change + // in the future as of 2009-09-24, on which I cannot be sure this structure + // is completely consolidated. + // When we are sure we will no longer change them, we'll be happy to + // make it complete public (withouth @hide tag) + // + // Also note that these getter methods should be used only after + // all properties being pushed into this object. If not, incorrect + // value will "be stored in the local cache and" be returned to you. /** - * @hide only for testing. + * @hide + */ + public String getFamilyName() { + return mFamilyName; + } + + /** + * @hide + */ + public String getGivenName() { + return mGivenName; + } + + /** + * @hide + */ + public String getMiddleName() { + return mMiddleName; + } + + /** + * @hide + */ + public String getPrefix() { + return mPrefix; + } + + /** + * @hide + */ + public String getSuffix() { + return mSuffix; + } + + /** + * @hide + */ + public String getFullName() { + return mFullName; + } + + /** + * @hide + */ + public String getPhoneticFamilyName() { + return mPhoneticFamilyName; + } + + /** + * @hide + */ + public String getPhoneticGivenName() { + return mPhoneticGivenName; + } + + /** + * @hide + */ + public String getPhoneticMiddleName() { + return mPhoneticMiddleName; + } + + /** + * @hide + */ + public String getPhoneticFullName() { + return mPhoneticFullName; + } + + /** + * @hide + */ + public final List<String> getNickNameList() { + return mNickNameList; + } + + /** + * @hide + */ + public String getDisplayName() { + if (mDisplayName == null) { + constructDisplayName(); + } + return mDisplayName; + } + + /** + * @hide + */ + public String getBirthday() { + return mBirthday; + } + + /** + * @hide */ public final List<PhotoData> getPhotoList() { return mPhotoList; } - + /** - * @hide only for testing. + * @hide */ public final List<String> getNotes() { return mNoteList; } /** - * @hide only for testing. + * @hide */ public final List<PhoneData> getPhoneList() { return mPhoneList; } /** - * @hide only for testing. + * @hide */ public final List<EmailData> getEmailList() { return mEmailList; } /** - * @hide only for testing. + * @hide */ public final List<PostalData> getPostalList() { return mPostalList; } /** - * @hide only for testing. + * @hide */ public final List<OrganizationData> getOrganizationList() { return mOrganizationList; @@ -938,13 +1042,6 @@ public class ContactStruct { // Unknown X- words and IANA token. } } - - public String getDisplayName() { - if (mDisplayName == null) { - constructDisplayName(); - } - return mDisplayName; - } /** * Construct the display name. The constructed data must not be null. diff --git a/core/java/android/pim/vcard/VCardComposer.java b/core/java/android/pim/vcard/VCardComposer.java index 45f7ef3f18c0..cff18bccae02 100644 --- a/core/java/android/pim/vcard/VCardComposer.java +++ b/core/java/android/pim/vcard/VCardComposer.java @@ -960,10 +960,12 @@ public class VCardComposer { .get(Phone.CONTENT_ITEM_TYPE); if (contentValuesList != null) { for (ContentValues contentValues : contentValuesList) { - appendVCardTelephoneLine(builder, contentValues - .getAsInteger(Phone.TYPE), contentValues - .getAsString(Phone.LABEL), contentValues - .getAsString(Phone.NUMBER)); + Integer phoneType = contentValues.getAsInteger(Phone.TYPE); + int phoneTypeAsPrimitive = + (phoneType == null ? Phone.TYPE_HOME : phoneType); + appendVCardTelephoneLine(builder, phoneTypeAsPrimitive, + contentValues.getAsString(Phone.LABEL), + contentValues.getAsString(Phone.NUMBER)); } } else if (mIsDoCoMo) { appendVCardTelephoneLine(builder, Phone.TYPE_HOME, "", ""); @@ -1090,7 +1092,7 @@ public class VCardComposer { private void appendBirthday(final StringBuilder builder, final Map<String, List<ContentValues>> contentValuesListMap) { List<ContentValues> contentValuesList = contentValuesListMap - .get(Website.CONTENT_ITEM_TYPE); + .get(Miscellaneous.CONTENT_ITEM_TYPE); if (contentValuesList != null && contentValuesList.size() > 0) { // Theoretically, there must be only one birthday for each vCard data and // we are afraid of some parse error occuring in some devices, so |