Loading src/com/android/contacts/ContactsUtils.java +2 −2 Original line number Diff line number Diff line Loading @@ -102,8 +102,8 @@ public class ContactsUtils { * considered equal for collapsing in the GUI. For caller-id, use * {@link PhoneNumberUtils#compare(Context, String, String)} instead */ public static final boolean shouldCollapse(Context context, CharSequence mimetype1, CharSequence data1, CharSequence mimetype2, CharSequence data2) { public static final boolean shouldCollapse(CharSequence mimetype1, CharSequence data1, CharSequence mimetype2, CharSequence data2) { // different mimetypes? don't collapse if (!TextUtils.equals(mimetype1, mimetype2)) return false; Loading src/com/android/contacts/detail/ContactDetailFragment.java +1 −2 Original line number Diff line number Diff line Loading @@ -1348,8 +1348,7 @@ public class ContactDetailFragment extends Fragment implements FragmentKeyListen return false; } if (!ContactsUtils.shouldCollapse(context, mimetype, data, entry.mimetype, entry.data)) { if (!ContactsUtils.shouldCollapse(mimetype, data, entry.mimetype, entry.data)) { return false; } Loading src/com/android/contacts/interactions/PhoneNumberInteraction.java +3 −12 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package com.android.contacts.interactions; import com.android.contacts.Collapser; import com.android.contacts.Collapser.Collapsible; import com.android.contacts.ContactSaveService; import com.android.contacts.ContactsUtils; import com.android.contacts.R; import com.android.contacts.model.AccountType; import com.android.contacts.model.AccountType.StringInflater; Loading Loading @@ -123,18 +124,8 @@ public class PhoneNumberInteraction implements OnLoadCompleteListener<Cursor> { } public boolean shouldCollapseWith(PhoneItem phoneItem) { try { PhoneNumberUtil util = PhoneNumberUtil.getInstance(); PhoneNumber phoneNumber1 = util.parse(phoneNumber, "ZZ" /* Unknown */); PhoneNumber phoneNumber2 = util.parse(phoneItem.phoneNumber, "ZZ" /* Unknown */); MatchType matchType = util.isNumberMatch(phoneNumber1, phoneNumber2); if (matchType == MatchType.SHORT_NSN_MATCH) { return true; } } catch (NumberParseException e) { return TextUtils.equals(phoneNumber, phoneItem.phoneNumber); } return false; return ContactsUtils.shouldCollapse(Phone.CONTENT_ITEM_TYPE, phoneNumber, Phone.CONTENT_ITEM_TYPE, phoneItem.phoneNumber); } @Override Loading src/com/android/contacts/quickcontact/DataAction.java +1 −2 Original line number Diff line number Diff line Loading @@ -294,8 +294,7 @@ public class DataAction implements Action { return false; } DataAction that = (DataAction)t; if (!ContactsUtils.shouldCollapse(mContext, mMimeType, mBody, that.mMimeType, that.mBody)) { if (!ContactsUtils.shouldCollapse(mMimeType, mBody, that.mMimeType, that.mBody)) { return false; } if (!TextUtils.equals(mMimeType, that.mMimeType) Loading tests/src/com/android/contacts/ContactsUtilsTests.java +4 −4 Original line number Diff line number Diff line Loading @@ -160,9 +160,9 @@ public class ContactsUtilsTests extends AndroidTestCase { private void assertCollapses(String message, boolean expected, CharSequence mimetype1, CharSequence data1, CharSequence mimetype2, CharSequence data2) { assertEquals(message, expected, ContactsUtils.shouldCollapse(mContext, mimetype1, data1, mimetype2, data2)); ContactsUtils.shouldCollapse(mimetype1, data1, mimetype2, data2)); assertEquals(message, expected, ContactsUtils.shouldCollapse(mContext, mimetype2, data2, mimetype1, data1)); ContactsUtils.shouldCollapse(mimetype2, data2, mimetype1, data1)); if (data1 == data2 && data1 != null) { // make sure we also do a test where object equality is not given Loading @@ -173,10 +173,10 @@ public class ContactsUtilsTests extends AndroidTestCase { // we have two different instances, now make sure we get the same result as before assertEquals(message, expected, ContactsUtils.shouldCollapse(mContext, mimetype1, data1, mimetype2, ContactsUtils.shouldCollapse(mimetype1, data1, mimetype2, data2_newref)); assertEquals(message, expected, ContactsUtils.shouldCollapse(mContext, mimetype2, data2_newref, mimetype1, ContactsUtils.shouldCollapse(mimetype2, data2_newref, mimetype1, data1)); } } Loading Loading
src/com/android/contacts/ContactsUtils.java +2 −2 Original line number Diff line number Diff line Loading @@ -102,8 +102,8 @@ public class ContactsUtils { * considered equal for collapsing in the GUI. For caller-id, use * {@link PhoneNumberUtils#compare(Context, String, String)} instead */ public static final boolean shouldCollapse(Context context, CharSequence mimetype1, CharSequence data1, CharSequence mimetype2, CharSequence data2) { public static final boolean shouldCollapse(CharSequence mimetype1, CharSequence data1, CharSequence mimetype2, CharSequence data2) { // different mimetypes? don't collapse if (!TextUtils.equals(mimetype1, mimetype2)) return false; Loading
src/com/android/contacts/detail/ContactDetailFragment.java +1 −2 Original line number Diff line number Diff line Loading @@ -1348,8 +1348,7 @@ public class ContactDetailFragment extends Fragment implements FragmentKeyListen return false; } if (!ContactsUtils.shouldCollapse(context, mimetype, data, entry.mimetype, entry.data)) { if (!ContactsUtils.shouldCollapse(mimetype, data, entry.mimetype, entry.data)) { return false; } Loading
src/com/android/contacts/interactions/PhoneNumberInteraction.java +3 −12 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package com.android.contacts.interactions; import com.android.contacts.Collapser; import com.android.contacts.Collapser.Collapsible; import com.android.contacts.ContactSaveService; import com.android.contacts.ContactsUtils; import com.android.contacts.R; import com.android.contacts.model.AccountType; import com.android.contacts.model.AccountType.StringInflater; Loading Loading @@ -123,18 +124,8 @@ public class PhoneNumberInteraction implements OnLoadCompleteListener<Cursor> { } public boolean shouldCollapseWith(PhoneItem phoneItem) { try { PhoneNumberUtil util = PhoneNumberUtil.getInstance(); PhoneNumber phoneNumber1 = util.parse(phoneNumber, "ZZ" /* Unknown */); PhoneNumber phoneNumber2 = util.parse(phoneItem.phoneNumber, "ZZ" /* Unknown */); MatchType matchType = util.isNumberMatch(phoneNumber1, phoneNumber2); if (matchType == MatchType.SHORT_NSN_MATCH) { return true; } } catch (NumberParseException e) { return TextUtils.equals(phoneNumber, phoneItem.phoneNumber); } return false; return ContactsUtils.shouldCollapse(Phone.CONTENT_ITEM_TYPE, phoneNumber, Phone.CONTENT_ITEM_TYPE, phoneItem.phoneNumber); } @Override Loading
src/com/android/contacts/quickcontact/DataAction.java +1 −2 Original line number Diff line number Diff line Loading @@ -294,8 +294,7 @@ public class DataAction implements Action { return false; } DataAction that = (DataAction)t; if (!ContactsUtils.shouldCollapse(mContext, mMimeType, mBody, that.mMimeType, that.mBody)) { if (!ContactsUtils.shouldCollapse(mMimeType, mBody, that.mMimeType, that.mBody)) { return false; } if (!TextUtils.equals(mMimeType, that.mMimeType) Loading
tests/src/com/android/contacts/ContactsUtilsTests.java +4 −4 Original line number Diff line number Diff line Loading @@ -160,9 +160,9 @@ public class ContactsUtilsTests extends AndroidTestCase { private void assertCollapses(String message, boolean expected, CharSequence mimetype1, CharSequence data1, CharSequence mimetype2, CharSequence data2) { assertEquals(message, expected, ContactsUtils.shouldCollapse(mContext, mimetype1, data1, mimetype2, data2)); ContactsUtils.shouldCollapse(mimetype1, data1, mimetype2, data2)); assertEquals(message, expected, ContactsUtils.shouldCollapse(mContext, mimetype2, data2, mimetype1, data1)); ContactsUtils.shouldCollapse(mimetype2, data2, mimetype1, data1)); if (data1 == data2 && data1 != null) { // make sure we also do a test where object equality is not given Loading @@ -173,10 +173,10 @@ public class ContactsUtilsTests extends AndroidTestCase { // we have two different instances, now make sure we get the same result as before assertEquals(message, expected, ContactsUtils.shouldCollapse(mContext, mimetype1, data1, mimetype2, ContactsUtils.shouldCollapse(mimetype1, data1, mimetype2, data2_newref)); assertEquals(message, expected, ContactsUtils.shouldCollapse(mContext, mimetype2, data2_newref, mimetype1, ContactsUtils.shouldCollapse(mimetype2, data2_newref, mimetype1, data1)); } } Loading