Improvements & fixes related to phone numbers
This commit is contained in:
parent
3ab5835059
commit
b01e60aaed
3 changed files with 27 additions and 24 deletions
|
@ -119,7 +119,8 @@ public class ContactDetailsFragment extends Fragment implements OnClickListener
|
|||
boolean skip = false;
|
||||
View v = inflater.inflate(R.layout.contact_control_row, null);
|
||||
|
||||
String displayednumberOrAddress = LinphoneUtils.getDisplayableUsernameFromAddress(noa.getValue());
|
||||
String value = noa.getValue();
|
||||
String displayednumberOrAddress = LinphoneUtils.getDisplayableUsernameFromAddress(value);
|
||||
|
||||
TextView label = (TextView) v.findViewById(R.id.address_label);
|
||||
if (noa.isSIPAddress()) {
|
||||
|
@ -134,39 +135,34 @@ public class ContactDetailsFragment extends Fragment implements OnClickListener
|
|||
tv.setText(displayednumberOrAddress);
|
||||
tv.setSelected(true);
|
||||
|
||||
|
||||
LinphoneProxyConfig lpc = LinphoneManager.getLc().getDefaultProxyConfig();
|
||||
if (lpc != null) {
|
||||
String username = lpc.normalizePhoneNumber(displayednumberOrAddress);
|
||||
value = LinphoneUtils.getFullAddressFromUsername(username);
|
||||
}
|
||||
|
||||
String contactAddress = contact.getPresenceModelForUri(noa.getValue());
|
||||
if(contactAddress != null) {
|
||||
if (contactAddress != null) {
|
||||
v.findViewById(R.id.friendLinphone).setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
if (!displayChatAddressOnly) {
|
||||
v.findViewById(R.id.contact_call).setOnClickListener(dialListener);
|
||||
if(contactAddress != null){
|
||||
v.findViewById(R.id.contact_call).setTag(contact.getPresenceModelForUri(noa.getValue()));
|
||||
if (contactAddress != null) {
|
||||
v.findViewById(R.id.contact_call).setTag(contactAddress);
|
||||
} else {
|
||||
v.findViewById(R.id.contact_call).setTag(displayednumberOrAddress);
|
||||
v.findViewById(R.id.contact_call).setTag(value);
|
||||
}
|
||||
} else {
|
||||
v.findViewById(R.id.contact_call).setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
v.findViewById(R.id.contact_chat).setOnClickListener(chatListener);
|
||||
LinphoneProxyConfig lpc = LinphoneManager.getLc().getDefaultProxyConfig();
|
||||
if (lpc != null) {
|
||||
String username = lpc.normalizePhoneNumber(LinphoneUtils.getUsernameFromAddress(noa.getValue()));
|
||||
String tag = LinphoneUtils.getFullAddressFromUsername(username);
|
||||
|
||||
if(contactAddress != null){
|
||||
v.findViewById(R.id.contact_chat).setTag(contact.getPresenceModelForUri(noa.getValue()));
|
||||
} else {
|
||||
v.findViewById(R.id.contact_chat).setTag(tag);
|
||||
}
|
||||
if (contactAddress != null) {
|
||||
v.findViewById(R.id.contact_chat).setTag(contactAddress);
|
||||
} else {
|
||||
if(contactAddress != null){
|
||||
v.findViewById(R.id.contact_chat).setTag(contact.getPresenceModelForUri(noa.getValue()));
|
||||
} else {
|
||||
v.findViewById(R.id.contact_chat).setTag(noa.getValue());
|
||||
}
|
||||
v.findViewById(R.id.contact_chat).setTag(value);
|
||||
}
|
||||
|
||||
if (getResources().getBoolean(R.bool.disable_chat)) {
|
||||
|
|
|
@ -743,6 +743,9 @@ public class LinphoneContact implements Serializable, Comparable<LinphoneContact
|
|||
if (isSIP && !number.startsWith("sip:")) {
|
||||
number = "sip:" + number;
|
||||
}
|
||||
if (isSIP && !number.contains("@")) {
|
||||
number = number + "@" + ContactsManager.getInstance().getString(R.string.default_domain);
|
||||
}
|
||||
result.add(new LinphoneNumberOrAddress(number, isSIP));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -471,15 +471,19 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
|
|||
// return;
|
||||
// }
|
||||
|
||||
LinphoneProxyConfig lpc = getLc().getDefaultProxyConfig();
|
||||
if (lpc != null) {
|
||||
to = lpc.normalizePhoneNumber(to);
|
||||
}
|
||||
|
||||
LinphoneAddress lAddress;
|
||||
try {
|
||||
lAddress = mLc.interpretUrl(to);
|
||||
LinphoneProxyConfig lpc = mLc.getDefaultProxyConfig();
|
||||
|
||||
if (mR.getBoolean(R.bool.forbid_self_call) && lpc!=null && lAddress.asStringUriOnly().equals(lpc.getIdentity())) {
|
||||
if (mR.getBoolean(R.bool.forbid_self_call) && lpc != null && lAddress.asStringUriOnly().equals(lpc.getIdentity())) {
|
||||
return;
|
||||
}
|
||||
} catch (LinphoneCoreException e) {
|
||||
Log.e(e);
|
||||
return;
|
||||
}
|
||||
lAddress.setDisplayName(displayName);
|
||||
|
|
Loading…
Reference in a new issue