Added possibility to chat an address not present in any existing contact
This commit is contained in:
parent
a91f3b4f99
commit
f89ef35865
4 changed files with 20 additions and 7 deletions
|
@ -219,8 +219,13 @@ public class ChatCreationFragment extends Fragment implements View.OnClickListen
|
|||
csv.setListener(this);
|
||||
csv.setContactName(ca);
|
||||
contactsSelected.add(ca);
|
||||
|
||||
View viewContact = LayoutInflater.from(LinphoneActivity.instance()).inflate(R.layout.contact_selected, null);
|
||||
if (ca.getContact() != null) {
|
||||
((TextView) viewContact.findViewById(R.id.sipUri)).setText(ca.getContact().getFullName());
|
||||
} else {
|
||||
((TextView) viewContact.findViewById(R.id.sipUri)).setText(ca.getAddress());
|
||||
}
|
||||
View removeContact = viewContact.findViewById(R.id.contactChatDelete);
|
||||
removeContact.setTag(ca);
|
||||
removeContact.setOnClickListener(this);
|
||||
|
|
|
@ -35,6 +35,7 @@ public class ChatEventsAdapter extends BaseAdapter {
|
|||
|
||||
public ChatEventsAdapter(LayoutInflater inflater) {
|
||||
mLayoutInflater = inflater;
|
||||
mHistory = new ArrayList<>(); //TODO
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -303,7 +303,7 @@ public class GroupChatFragment extends Fragment implements ChatRoomListener, Con
|
|||
|
||||
private void displayChatRoomHistory() {
|
||||
mMessagesAdapter = new ChatEventsAdapter(mInflater);
|
||||
//TODO
|
||||
mChatEventsList.setAdapter(mMessagesAdapter);
|
||||
}
|
||||
|
||||
private void sendMessage() {
|
||||
|
|
|
@ -162,12 +162,14 @@ public class SearchContactsListAdapter extends BaseAdapter {
|
|||
return;
|
||||
}
|
||||
|
||||
List<ContactAddress> result = new ArrayList<ContactAddress>();
|
||||
List<ContactAddress> result = new ArrayList<>();
|
||||
String searchAddress = "sip:" + search + "@" + LinphoneManager.getLc().getDefaultProxyConfig().getDomain();
|
||||
result.add(new ContactAddress(null, searchAddress, false));
|
||||
if (search != null) {
|
||||
for (ContactAddress c : (search.length() < oldSize) ? getContactsList() : getContacts()) {
|
||||
String address = c.getAddress();
|
||||
if (address.startsWith("sip:")) address = address.substring(4);
|
||||
if (c.getContact().getFullName() != null
|
||||
if (c.getContact() != null && c.getContact().getFullName() != null
|
||||
&& c.getContact().getFullName().toLowerCase(Locale.getDefault()).startsWith(search.toLowerCase(Locale.getDefault()))
|
||||
|| address.toLowerCase(Locale.getDefault()).startsWith(search.toLowerCase(Locale.getDefault()))) {
|
||||
result.add(c);
|
||||
|
@ -202,13 +204,18 @@ public class SearchContactsListAdapter extends BaseAdapter {
|
|||
final String a = contact.getAddress();
|
||||
LinphoneContact c = contact.getContact();
|
||||
|
||||
if (c.hasPhoto()) {
|
||||
if (c != null && c.hasPhoto()) {
|
||||
LinphoneUtils.setThumbnailPictureFromUri(LinphoneActivity.instance(), holder.avatar, c.getThumbnailUri());
|
||||
} else {
|
||||
holder.avatar.setImageBitmap(ContactsManager.getInstance().getDefaultAvatarBitmap());
|
||||
}
|
||||
|
||||
if (c != null) {
|
||||
holder.name.setVisibility(View.VISIBLE);
|
||||
holder.name.setText(c.getFullName());
|
||||
} else {
|
||||
holder.name.setVisibility(View.GONE);
|
||||
}
|
||||
holder.address.setText(a);
|
||||
if (holder.linphoneContact != null) {
|
||||
if (contact.isLinphoneContact()) {
|
||||
|
|
Loading…
Reference in a new issue