Merge change 25130 into eclair

* changes:
  Support StructuredName.DISPLAY_NAME for Exchange contacts
This commit is contained in:
Android (Google) Code Review 2009-09-15 23:12:24 -04:00
commit fc7dfddf19

View File

@ -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 {