Fixed contacts search list content when multiple contacts have same address or one contact has multiple addresses
This commit is contained in:
parent
b54488915e
commit
7223bc481c
1 changed files with 9 additions and 20 deletions
|
@ -116,16 +116,14 @@ public class SearchContactsListAdapter extends BaseAdapter {
|
||||||
public List<ContactAddress> getContactsList() {
|
public List<ContactAddress> getContactsList() {
|
||||||
List<ContactAddress> list = new ArrayList<>();
|
List<ContactAddress> list = new ArrayList<>();
|
||||||
if (ContactsManager.getInstance().hasContacts()) {
|
if (ContactsManager.getInstance().hasContacts()) {
|
||||||
for (Address addr : LinphoneManager.getLc().findContactsByChar("", mOnlySipContact)) {
|
List<LinphoneContact> contacts = mOnlySipContact ? ContactsManager.getInstance().getContacts() : ContactsManager.getInstance().getSIPContacts();
|
||||||
LinphoneContact cont = ContactsManager.getInstance().findContactFromAddress(addr);
|
for (LinphoneContact contact : contacts) {
|
||||||
if (cont == null) {
|
for (LinphoneNumberOrAddress noa : contact.getNumbersOrAddresses()) {
|
||||||
cont = new LinphoneContact();
|
if (noa.isSIPAddress()) {
|
||||||
cont.setFullName(addr.getUsername());
|
ContactAddress ca = new ContactAddress(contact , noa.getValue(), contact.isFriend());
|
||||||
|
list.add(ca);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// TODO Rechercher si un contact est associé à cette sip uri
|
|
||||||
// TODO Rechercher si un displayname est associé à cette sip uri
|
|
||||||
ContactAddress ca = new ContactAddress(cont , addr.asString(), cont.isFriend());
|
|
||||||
list.add(ca);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -142,12 +140,7 @@ public class SearchContactsListAdapter extends BaseAdapter {
|
||||||
}
|
}
|
||||||
|
|
||||||
public ContactAddress getItem(int position) {
|
public ContactAddress getItem(int position) {
|
||||||
if (contacts == null || position >= contacts.size()) {
|
return contacts.get(position);
|
||||||
contacts = getContactsList();
|
|
||||||
return contacts.get(position);
|
|
||||||
} else {
|
|
||||||
return contacts.get(position);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getItemId(int position) {
|
public long getItemId(int position) {
|
||||||
|
@ -195,11 +188,6 @@ public class SearchContactsListAdapter extends BaseAdapter {
|
||||||
public View getView(int position, View convertView, ViewGroup parent) {
|
public View getView(int position, View convertView, ViewGroup parent) {
|
||||||
View view;
|
View view;
|
||||||
ViewHolder holder;
|
ViewHolder holder;
|
||||||
ContactAddress contact;
|
|
||||||
|
|
||||||
do {
|
|
||||||
contact = getItem(position);
|
|
||||||
} while (contact == null);
|
|
||||||
|
|
||||||
if (convertView != null) {
|
if (convertView != null) {
|
||||||
view = convertView;
|
view = convertView;
|
||||||
|
@ -210,6 +198,7 @@ public class SearchContactsListAdapter extends BaseAdapter {
|
||||||
view.setTag(holder);
|
view.setTag(holder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ContactAddress contact = getItem(position);
|
||||||
final String a = contact.getAddress();
|
final String a = contact.getAddress();
|
||||||
LinphoneContact c = contact.getContact();
|
LinphoneContact c = contact.getContact();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue