Improved and fixes for contacts list in char room group creation
This commit is contained in:
parent
79bfba7a09
commit
4fa623033d
2 changed files with 10 additions and 7 deletions
|
@ -150,11 +150,12 @@ public class ChatCreationFragment extends Fragment implements View.OnClickListen
|
||||||
updateListSelected();
|
updateListSelected();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mOnlyDisplayLinphoneContacts = true;
|
||||||
if (savedInstanceState != null ) {
|
if (savedInstanceState != null ) {
|
||||||
mOnlyDisplayLinphoneContacts = savedInstanceState.getBoolean("onlySipContact");
|
mOnlyDisplayLinphoneContacts = savedInstanceState.getBoolean("onlySipContact", true);
|
||||||
updateList();
|
|
||||||
}
|
}
|
||||||
mSearchAdapter.setOnlySipContact(mOnlyDisplayLinphoneContacts);
|
mSearchAdapter.setOnlySipContact(mOnlyDisplayLinphoneContacts);
|
||||||
|
updateList();
|
||||||
|
|
||||||
displayChatCreation();
|
displayChatCreation();
|
||||||
|
|
||||||
|
|
|
@ -116,12 +116,12 @@ 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()) {
|
||||||
List<LinphoneContact> contacts = mOnlySipContact ? ContactsManager.getInstance().getContacts() : ContactsManager.getInstance().getSIPContacts();
|
List<LinphoneContact> contacts = mOnlySipContact ? ContactsManager.getInstance().getSIPContacts() : ContactsManager.getInstance().getContacts();
|
||||||
for (LinphoneContact contact : contacts) {
|
for (LinphoneContact contact : contacts) {
|
||||||
for (LinphoneNumberOrAddress noa : contact.getNumbersOrAddresses()) {
|
for (LinphoneNumberOrAddress noa : contact.getNumbersOrAddresses()) {
|
||||||
if (noa.isSIPAddress()) {
|
if (!mOnlySipContact || (mOnlySipContact && contact.getPresenceModelForUriOrTel(noa.getValue()) != null)) {
|
||||||
Address address = LinphoneManager.getLc().interpretUrl(noa.getValue());
|
Address address = LinphoneManager.getLc().interpretUrl(noa.getValue());
|
||||||
ContactAddress ca = new ContactAddress(contact , address.asString(), contact.isFriend());
|
ContactAddress ca = new ContactAddress(contact, address.asString(), contact.isFriend());
|
||||||
list.add(ca);
|
list.add(ca);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -211,7 +211,9 @@ public class SearchContactsListAdapter extends BaseAdapter {
|
||||||
LinphoneUtils.setThumbnailPictureFromUri(LinphoneActivity.instance(), holder.avatar, c.getThumbnailUri());
|
LinphoneUtils.setThumbnailPictureFromUri(LinphoneActivity.instance(), holder.avatar, c.getThumbnailUri());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String address = null;
|
||||||
if (c != null) {
|
if (c != null) {
|
||||||
|
address = c.getPresenceModelForUriOrTel(a);
|
||||||
holder.name.setVisibility(View.VISIBLE);
|
holder.name.setVisibility(View.VISIBLE);
|
||||||
holder.name.setText(c.getFullName());
|
holder.name.setText(c.getFullName());
|
||||||
} else {
|
} else {
|
||||||
|
@ -219,7 +221,7 @@ public class SearchContactsListAdapter extends BaseAdapter {
|
||||||
}
|
}
|
||||||
holder.address.setText(a);
|
holder.address.setText(a);
|
||||||
if (holder.linphoneContact != null) {
|
if (holder.linphoneContact != null) {
|
||||||
if (contact.isLinphoneContact()) {
|
if (contact.isLinphoneContact() && c != null && c.isInFriendList() && address != null) {
|
||||||
holder.linphoneContact.setVisibility(View.VISIBLE);
|
holder.linphoneContact.setVisibility(View.VISIBLE);
|
||||||
} else {
|
} else {
|
||||||
holder.linphoneContact.setVisibility(View.GONE);
|
holder.linphoneContact.setVisibility(View.GONE);
|
||||||
|
@ -232,7 +234,7 @@ public class SearchContactsListAdapter extends BaseAdapter {
|
||||||
holder.isSelect.setVisibility(View.INVISIBLE);
|
holder.isSelect.setVisibility(View.INVISIBLE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
view.setTag(R.id.contact_search_name, a);
|
view.setTag(R.id.contact_search_name, address != null ? address : a);
|
||||||
if (listener != null)
|
if (listener != null)
|
||||||
view.setOnClickListener(listener);
|
view.setOnClickListener(listener);
|
||||||
return view;
|
return view;
|
||||||
|
|
Loading…
Reference in a new issue