summaryrefslogtreecommitdiffstats
path: root/src/com/android/contacts/common/model/dataitem/ImDataItem.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/contacts/common/model/dataitem/ImDataItem.java')
-rw-r--r--src/com/android/contacts/common/model/dataitem/ImDataItem.java25
1 files changed, 13 insertions, 12 deletions
diff --git a/src/com/android/contacts/common/model/dataitem/ImDataItem.java b/src/com/android/contacts/common/model/dataitem/ImDataItem.java
index d1af2462..f89e5c6a 100644
--- a/src/com/android/contacts/common/model/dataitem/ImDataItem.java
+++ b/src/com/android/contacts/common/model/dataitem/ImDataItem.java
@@ -21,6 +21,7 @@ import android.content.Context;
import android.provider.ContactsContract;
import android.provider.ContactsContract.CommonDataKinds.Email;
import android.provider.ContactsContract.CommonDataKinds.Im;
+import android.text.TextUtils;
/**
* Represents an IM data item, wrapping the columns in
@@ -91,21 +92,21 @@ public class ImDataItem extends DataItem {
// IM can have the same data put different protocol. These should not collapse.
if (!getData().equals(that.getData())) {
return false;
- } else if (isProtocolValid() && that.isProtocolValid() &&
- getProtocol() != that.getProtocol()) {
+ } else if (!isProtocolValid() || !that.isProtocolValid()) {
+ // Deal with invalid protocol as if it was custom. If either has a non valid
+ // protocol, check to see if the other has a valid that is not custom
+ if (isProtocolValid()) {
+ return getProtocol() == Im.PROTOCOL_CUSTOM;
+ } else if (that.isProtocolValid()) {
+ return that.getProtocol() == Im.PROTOCOL_CUSTOM;
+ }
+ return true;
+ } else if (getProtocol() != that.getProtocol()) {
return false;
- } else if (isProtocolValid() && that.isProtocolValid() &&
- getProtocol() == Im.PROTOCOL_CUSTOM &&
- !getCustomProtocol().equals(that.getCustomProtocol())) {
+ } else if (getProtocol() == Im.PROTOCOL_CUSTOM &&
+ !TextUtils.equals(getCustomProtocol(), that.getCustomProtocol())) {
// Check if custom protocols are not the same
return false;
- } else if ((isProtocolValid() && !that.isProtocolValid() &&
- getProtocol() != Im.PROTOCOL_CUSTOM) ||
- (that.isProtocolValid() && !isProtocolValid() &&
- that.getProtocol() != Im.PROTOCOL_CUSTOM)) {
- // Deal with invalid protocol as if it was custom. If either has a non valid protocol,
- // check to see if the other has a valid that is not custom
- return false;
}
return true;
}