Make exchange contact category names visible; also their members

Change-Id: Icaf7c2828db4fda7323b3ec3a6c9cd783ae80c9a
This commit is contained in:
Marc Blank 2009-09-11 08:53:07 -07:00
parent 86ada729c2
commit 3c7f0d4c00
1 changed files with 26 additions and 5 deletions

View File

@ -112,7 +112,9 @@ public class ContactsSyncAdapter extends AbstractSyncAdapter {
ArrayList<Long> mDeletedIdList = new ArrayList<Long>();
ArrayList<Long> mUpdatedIdList = new ArrayList<Long>();
android.accounts.Account mAccountManagerAccount;
private boolean mGroupsUsed = false;
private android.accounts.Account mAccountManagerAccount;
public ContactsSyncAdapter(Mailbox mailbox, EasSyncService service) {
super(mailbox, service);
@ -522,14 +524,11 @@ public class ContactsSyncAdapter extends AbstractSyncAdapter {
ops.addNote(entity, getValue());
break;
// TODO Handle Categories/Category
// If we don't handle this properly, we'll lose the information if/when we
// upload changes to the server!
case Tags.CONTACTS_CATEGORIES:
mGroupsUsed = true;
categoriesParser(ops, entity);
break;
case Tags.CONTACTS_COMPRESSED_RTF:
// We don't use this, and it isn't necessary to upload, so we'll ignore it
skipTag();
@ -1379,6 +1378,28 @@ public class ContactsSyncAdapter extends AbstractSyncAdapter {
.build());
}
ops.execute();
ContentResolver cr = mContext.getContentResolver();
if (mGroupsUsed) {
// Make sure the title column is set for all of our groups
// And that all of our groups are visible
// TODO Perhaps the visible part should only happen when the group is created, but
// this is fine for now.
Uri groupsUri = uriWithAccount(Groups.CONTENT_URI);
Cursor c = cr.query(groupsUri, new String[] {Groups.SOURCE_ID, Groups.TITLE},
Groups.TITLE + " IS NULL", null, null);
ContentValues values = new ContentValues();
values.put(Groups.GROUP_VISIBLE, 1);
try {
while (c.moveToNext()) {
String sourceId = c.getString(0);
values.put(Groups.TITLE, sourceId);
cr.update(uriWithAccount(groupsUri), values, Groups.SOURCE_ID + "=?",
new String[] {sourceId});
}
} finally {
c.close();
}
}
}
@Override