diff options
Diffstat (limited to 'src/com/android/contacts/common/model/dataitem/RelationDataItem.java')
-rw-r--r-- | src/com/android/contacts/common/model/dataitem/RelationDataItem.java | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/com/android/contacts/common/model/dataitem/RelationDataItem.java b/src/com/android/contacts/common/model/dataitem/RelationDataItem.java index b6992978..1ba3fcfb 100644 --- a/src/com/android/contacts/common/model/dataitem/RelationDataItem.java +++ b/src/com/android/contacts/common/model/dataitem/RelationDataItem.java @@ -17,6 +17,7 @@ package com.android.contacts.common.model.dataitem; import android.content.ContentValues; +import android.content.Context; import android.provider.ContactsContract; import android.provider.ContactsContract.CommonDataKinds.Relation; @@ -37,4 +38,23 @@ public class RelationDataItem extends DataItem { public String getLabel() { return getContentValues().getAsString(Relation.LABEL); } + + @Override + public boolean shouldCollapseWith(DataItem t, Context context) { + if (!(t instanceof RelationDataItem) || mKind == null || t.getDataKind() == null) { + return false; + } + final RelationDataItem that = (RelationDataItem) t; + // Relations can have different types (assistant, father) but have the same name + if (!getName().equals(that.getName())) { + return false; + } else if (getKindTypeColumn(mKind) != that.getKindTypeColumn(that.getDataKind())) { + return false; + } else if (getKindTypeColumn(mKind) == Relation.TYPE_CUSTOM && + !getLabel().equals(that.getLabel())) { + // Check if custom types are not the same + return false; + } + return true; + } } |