Use the newest customisations in chatroom creation list
(cherry picked from commit dba14a0bb921a8f76a23d71beb4985afda30ed2e)
This commit is contained in:
parent
dff64293ea
commit
4dd16231ef
2 changed files with 55 additions and 15 deletions
|
@ -239,18 +239,35 @@ public class ChatCreationFragment extends Fragment implements View.OnClickListen
|
|||
|
||||
mContactsList.setVisibility(View.VISIBLE);
|
||||
mSearchLayout.setVisibility(View.VISIBLE);
|
||||
mAllContactsButton.setVisibility(View.VISIBLE);
|
||||
mLinphoneContactsButton.setVisibility(View.VISIBLE);
|
||||
if (mOnlyDisplayLinphoneContacts) {
|
||||
mAllContactsSelected.setVisibility(View.INVISIBLE);
|
||||
mLinphoneContactsSelected.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
mAllContactsSelected.setVisibility(View.VISIBLE);
|
||||
mLinphoneContactsSelected.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
|
||||
mAllContactsButton.setEnabled(mOnlyDisplayLinphoneContacts);
|
||||
mLinphoneContactsButton.setEnabled(!mAllContactsButton.isEnabled());
|
||||
if (getResources().getBoolean(R.bool.hide_non_linphone_contacts)) {
|
||||
mLinphoneContactsButton.setVisibility(View.INVISIBLE);
|
||||
|
||||
mAllContactsButton.setEnabled(false);
|
||||
mLinphoneContactsButton.setEnabled(false);
|
||||
|
||||
mOnlyDisplayLinphoneContacts = true;
|
||||
|
||||
mAllContactsButton.setOnClickListener(null);
|
||||
mLinphoneContactsButton.setOnClickListener(null);
|
||||
|
||||
mLinphoneContactsSelected.setVisibility(View.INVISIBLE);
|
||||
mLinphoneContactsSelected.setVisibility(View.INVISIBLE);
|
||||
} else {
|
||||
mAllContactsButton.setVisibility(View.VISIBLE);
|
||||
mLinphoneContactsButton.setVisibility(View.VISIBLE);
|
||||
|
||||
if (mOnlyDisplayLinphoneContacts) {
|
||||
mAllContactsSelected.setVisibility(View.INVISIBLE);
|
||||
mLinphoneContactsSelected.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
mAllContactsSelected.setVisibility(View.VISIBLE);
|
||||
mLinphoneContactsSelected.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
|
||||
mAllContactsButton.setEnabled(mOnlyDisplayLinphoneContacts);
|
||||
mLinphoneContactsButton.setEnabled(!mAllContactsButton.isEnabled());
|
||||
}
|
||||
|
||||
mContactsSelectedLayout.removeAllViews();
|
||||
if (mContactsSelected.size() > 0) {
|
||||
|
|
|
@ -34,8 +34,11 @@ import org.linphone.R;
|
|||
import org.linphone.activities.LinphoneActivity;
|
||||
import org.linphone.core.Address;
|
||||
import org.linphone.core.Factory;
|
||||
import org.linphone.core.PresenceBasicStatus;
|
||||
import org.linphone.core.PresenceModel;
|
||||
import org.linphone.core.ProxyConfig;
|
||||
import org.linphone.core.SearchResult;
|
||||
import org.linphone.mediastream.Log;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
@ -251,6 +254,7 @@ public class SearchContactsListAdapter extends RecyclerView.Adapter<SearchContac
|
|||
String domain = "";
|
||||
ProxyConfig prx = LinphoneManager.getLc().getDefaultProxyConfig();
|
||||
if (prx != null) domain = prx.getDomain();
|
||||
Log.i("mOnlySipContact: " + mOnlySipContact + ", domain: " + domain);
|
||||
SearchResult[] results = ContactsManager.getInstance().getMagicSearch().getContactListFromFilter(search, mOnlySipContact ? domain : "");
|
||||
for (SearchResult sr : results) {
|
||||
boolean found = false;
|
||||
|
@ -275,10 +279,29 @@ public class SearchContactsListAdapter extends RecyclerView.Adapter<SearchContac
|
|||
}
|
||||
}
|
||||
if (!found) {
|
||||
result.add(new ContactAddress(contact,
|
||||
(sr.getAddress() != null) ? sr.getAddress().asStringUriOnly() : "",
|
||||
sr.getPhoneNumber(),
|
||||
contact.isFriend()));
|
||||
if (LinphoneActivity.instance().getResources().getBoolean(R.bool.hide_sip_contacts_without_presence)) {
|
||||
if (contact.getFriend() != null) {
|
||||
for (LinphoneNumberOrAddress noa : contact.getNumbersOrAddresses()) {
|
||||
PresenceModel pm = contact.getFriend().getPresenceModelForUriOrTel(noa.getValue());
|
||||
if (pm != null && pm.getBasicStatus().equals(PresenceBasicStatus.Open)) {
|
||||
result.add(new ContactAddress(contact,
|
||||
(sr.getAddress() != null) ? sr.getAddress().asStringUriOnly() : "",
|
||||
sr.getPhoneNumber(),
|
||||
contact.isFriend()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
result.add(new ContactAddress(contact,
|
||||
(sr.getAddress() != null) ? sr.getAddress().asStringUriOnly() : "",
|
||||
sr.getPhoneNumber(),
|
||||
contact.isFriend()));
|
||||
}
|
||||
Log.i("AJOUT CONTACT: " + contact.getFirstName());
|
||||
for(LinphoneNumberOrAddress a : contact.getNumbersOrAddresses()) {
|
||||
Log.i("\t" + a.getValue() + "(" + a.getNormalizedPhone() + ")");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue