Fixed issue with contacts with same display name but different informations
This commit is contained in:
parent
bc884cfb20
commit
ff5698986d
2 changed files with 12 additions and 10 deletions
|
@ -130,7 +130,6 @@ public class ContactsListFragment extends Fragment implements OnItemClickListene
|
|||
linphoneContacts.setEnabled(!allContacts.isEnabled());
|
||||
contactsFetchInProgress.setVisibility(View.VISIBLE);
|
||||
|
||||
|
||||
clearSearchField = view.findViewById(R.id.clearSearchField);
|
||||
clearSearchField.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
@ -166,7 +165,7 @@ public class ContactsListFragment extends Fragment implements OnItemClickListene
|
|||
dividerItemDecoration.setDrawable(getActivity().getResources().getDrawable(R.drawable.divider));
|
||||
contactsList.addItemDecoration(dividerItemDecoration);
|
||||
|
||||
contactsFetchInProgress = (ProgressBar) view.findViewById(R.id.contactsFetchInProgress);
|
||||
contactsFetchInProgress = view.findViewById(R.id.contactsFetchInProgress);
|
||||
contactsFetchInProgress.setVisibility(View.VISIBLE);
|
||||
|
||||
return view;
|
||||
|
@ -226,8 +225,6 @@ public class ContactsListFragment extends Fragment implements OnItemClickListene
|
|||
} else {
|
||||
listContact = ContactsManager.getInstance().getContacts();
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
if (onlyDisplayLinphoneContacts) {
|
||||
listContact = ContactsManager.getInstance().getSIPContacts(searchField.getText().toString());
|
||||
|
|
|
@ -71,6 +71,17 @@ public class LinphoneContact implements Serializable, Comparable<LinphoneContact
|
|||
public int compareTo(LinphoneContact contact) {
|
||||
String fullName = getFullName() != null ? getFullName().toUpperCase(Locale.getDefault()) : "";
|
||||
String contactFullName = contact.getFullName() != null ? contact.getFullName().toUpperCase(Locale.getDefault()) : "";
|
||||
|
||||
if (fullName.equals(contactFullName)) {
|
||||
if (getAndroidId() != null) {
|
||||
if (contact.getAndroidId() != null) {
|
||||
return getAndroidId().compareTo(contact.getAndroidId());
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
if (contact.getAndroidId() != null) return 1;
|
||||
return 0;
|
||||
}
|
||||
return fullName.compareTo(contactFullName);
|
||||
}
|
||||
|
||||
|
@ -700,12 +711,6 @@ public class LinphoneContact implements Serializable, Comparable<LinphoneContact
|
|||
if (mime != null && mime.length() > 0) {
|
||||
if (mime.equals(ContactsContract.CommonDataKinds.SipAddress.CONTENT_ITEM_TYPE) || mime.equals(ContactsManager.getInstance().getString(R.string.sync_mimetype))) {
|
||||
String number = c.getString(c.getColumnIndex("data1")); // SIP_ADDRESS
|
||||
if (!number.startsWith("sip:")) {
|
||||
number = "sip:" + number;
|
||||
}
|
||||
if (!number.contains("@")) {
|
||||
number = number + "@" + ContactsManager.getInstance().getString(R.string.default_domain);
|
||||
}
|
||||
result.add(new LinphoneNumberOrAddress(number, true));
|
||||
} else if (mime.equals(ContactsContract.CommonDataKinds.Phone.CONTENT_ITEM_TYPE)) {
|
||||
String number = c.getString(c.getColumnIndex("data1")); // PHONE_NUMBER
|
||||
|
|
Loading…
Reference in a new issue