From 71177c5375566801bc34bbc3f129a5452bb1d579 Mon Sep 17 00:00:00 2001 From: Marc Blank Date: Tue, 15 Sep 2009 14:34:03 -0700 Subject: [PATCH] Support StructuredName.DISPLAY_NAME for Exchange contacts * Fixes #2115514 Change-Id: Iac348c4ecac3bf8f895c32fff7077bc36d385bc9 --- .../exchange/adapter/ContactsSyncAdapter.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/com/android/exchange/adapter/ContactsSyncAdapter.java b/src/com/android/exchange/adapter/ContactsSyncAdapter.java index fc3204deb..8aa07d4b6 100644 --- a/src/com/android/exchange/adapter/ContactsSyncAdapter.java +++ b/src/com/android/exchange/adapter/ContactsSyncAdapter.java @@ -311,6 +311,7 @@ public class ContactsSyncAdapter extends AbstractSyncAdapter { public void addData(String serverId, ContactOperations ops, Entity entity) throws IOException { + String fileAs = null; String prefix = null; String firstName = null; String lastName = null; @@ -345,6 +346,9 @@ public class ContactsSyncAdapter extends AbstractSyncAdapter { case Tags.CONTACTS_MIDDLE_NAME: middleName = getValue(); break; + case Tags.CONTACTS_FILE_AS: + fileAs = getValue(); + break; case Tags.CONTACTS_SUFFIX: suffix = getValue(); break; @@ -504,9 +508,6 @@ public class ContactsSyncAdapter extends AbstractSyncAdapter { case Tags.CONTACTS_BIRTHDAY: personal.birthday = getValue(); break; - case Tags.CONTACTS_FILE_AS: - personal.fileAs = getValue(); - break; case Tags.CONTACTS_WEBPAGE: ops.addWebpage(entity, getValue()); break; @@ -552,7 +553,7 @@ public class ContactsSyncAdapter extends AbstractSyncAdapter { } ops.addName(entity, prefix, firstName, lastName, middleName, suffix, name, - yomiFirstName, yomiLastName); + yomiFirstName, yomiLastName, fileAs); ops.addBusiness(entity, business); ops.addPersonal(entity, personal); @@ -1114,7 +1115,7 @@ public class ContactsSyncAdapter extends AbstractSyncAdapter { public void addName(Entity entity, String prefix, String givenName, String familyName, String middleName, String suffix, String displayName, String yomiFirstName, - String yomiLastName) { + String yomiLastName, String fileAs) { RowBuilder builder = untypedRowBuilder(entity, StructuredName.CONTENT_ITEM_TYPE); ContentValues cv = builder.cv; if (cv != null && cvCompareString(cv, StructuredName.GIVEN_NAME, givenName) && @@ -1123,6 +1124,7 @@ public class ContactsSyncAdapter extends AbstractSyncAdapter { cvCompareString(cv, StructuredName.PREFIX, prefix) && cvCompareString(cv, StructuredName.PHONETIC_GIVEN_NAME, yomiFirstName) && cvCompareString(cv, StructuredName.PHONETIC_FAMILY_NAME, yomiLastName) && + cvCompareString(cv, StructuredName.DISPLAY_NAME, fileAs) && cvCompareString(cv, StructuredName.SUFFIX, suffix)) { return; } @@ -1133,6 +1135,7 @@ public class ContactsSyncAdapter extends AbstractSyncAdapter { builder.withValue(StructuredName.PHONETIC_GIVEN_NAME, yomiFirstName); builder.withValue(StructuredName.PHONETIC_FAMILY_NAME, yomiLastName); builder.withValue(StructuredName.PREFIX, prefix); + builder.withValue(StructuredName.DISPLAY_NAME, fileAs); add(builder.build()); } @@ -1500,6 +1503,9 @@ public class ContactsSyncAdapter extends AbstractSyncAdapter { if (cv.containsKey(StructuredName.PREFIX)) { s.data(Tags.CONTACTS_TITLE, cv.getAsString(StructuredName.PREFIX)); } + if (cv.containsKey(StructuredName.DISPLAY_NAME)) { + s.data(Tags.CONTACTS_FILE_AS, cv.getAsString(StructuredName.DISPLAY_NAME)); + } } private void sendBusiness(Serializer s, ContentValues cv) throws IOException {