summaryrefslogtreecommitdiffstats
path: root/src/com/android/contacts/common/model/dataitem/EventDataItem.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/contacts/common/model/dataitem/EventDataItem.java')
-rw-r--r--src/com/android/contacts/common/model/dataitem/EventDataItem.java20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/com/android/contacts/common/model/dataitem/EventDataItem.java b/src/com/android/contacts/common/model/dataitem/EventDataItem.java
index e664db18..aae00e97 100644
--- a/src/com/android/contacts/common/model/dataitem/EventDataItem.java
+++ b/src/com/android/contacts/common/model/dataitem/EventDataItem.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.Event;
@@ -37,4 +38,23 @@ public class EventDataItem extends DataItem {
public String getLabel() {
return getContentValues().getAsString(Event.LABEL);
}
+
+ @Override
+ public boolean shouldCollapseWith(DataItem t, Context context) {
+ if (!(t instanceof EventDataItem) || mKind == null || t.getDataKind() == null) {
+ return false;
+ }
+ final EventDataItem that = (EventDataItem) t;
+ // Events can be different (anniversary, birthday) but have the same start date
+ if (!getStartDate().equals(that.getStartDate())) {
+ return false;
+ } else if (getKindTypeColumn(mKind) != that.getKindTypeColumn(that.getDataKind())) {
+ return false;
+ } else if (getKindTypeColumn(mKind) == Event.TYPE_CUSTOM &&
+ !getLabel().equals(that.getLabel())) {
+ // Check if custom types are not the same
+ return false;
+ }
+ return true;
+ }
}