Added a customization setting to show full SIP addresses in contact detail & editor
This commit is contained in:
parent
6b3bff4412
commit
7416f5fe41
3 changed files with 16 additions and 8 deletions
|
@ -226,8 +226,11 @@ public class ContactDetailsFragment extends Fragment
|
||||||
View v = inflater.inflate(R.layout.contact_control_row, null);
|
View v = inflater.inflate(R.layout.contact_control_row, null);
|
||||||
|
|
||||||
String value = noa.getValue();
|
String value = noa.getValue();
|
||||||
String displayednumberOrAddress =
|
String displayedNumberOrAddress = value;
|
||||||
LinphoneUtils.getDisplayableUsernameFromAddress(value);
|
if (getResources()
|
||||||
|
.getBoolean(R.bool.only_show_address_username_if_matches_default_domain)) {
|
||||||
|
displayedNumberOrAddress = LinphoneUtils.getDisplayableUsernameFromAddress(value);
|
||||||
|
}
|
||||||
|
|
||||||
TextView label = v.findViewById(R.id.address_label);
|
TextView label = v.findViewById(R.id.address_label);
|
||||||
if (noa.isSIPAddress()) {
|
if (noa.isSIPAddress()) {
|
||||||
|
@ -239,12 +242,12 @@ public class ContactDetailsFragment extends Fragment
|
||||||
}
|
}
|
||||||
|
|
||||||
TextView tv = v.findViewById(R.id.numeroOrAddress);
|
TextView tv = v.findViewById(R.id.numeroOrAddress);
|
||||||
tv.setText(displayednumberOrAddress);
|
tv.setText(displayedNumberOrAddress);
|
||||||
tv.setSelected(true);
|
tv.setSelected(true);
|
||||||
|
|
||||||
ProxyConfig lpc = LinphoneManager.getLc().getDefaultProxyConfig();
|
ProxyConfig lpc = LinphoneManager.getLc().getDefaultProxyConfig();
|
||||||
if (lpc != null) {
|
if (lpc != null) {
|
||||||
String username = lpc.normalizePhoneNumber(displayednumberOrAddress);
|
String username = lpc.normalizePhoneNumber(displayedNumberOrAddress);
|
||||||
if (username != null) {
|
if (username != null) {
|
||||||
value = LinphoneUtils.getFullAddressFromUsername(username);
|
value = LinphoneUtils.getFullAddressFromUsername(username);
|
||||||
}
|
}
|
||||||
|
|
|
@ -563,13 +563,17 @@ public class ContactEditorFragment extends Fragment {
|
||||||
|
|
||||||
private View displayNumberOrAddress(
|
private View displayNumberOrAddress(
|
||||||
final LinearLayout controls, String numberOrAddress, boolean isSIP) {
|
final LinearLayout controls, String numberOrAddress, boolean isSIP) {
|
||||||
String displayNumberOrAddress = numberOrAddress;
|
String displayedNumberOrAddress = numberOrAddress;
|
||||||
if (isSIP) {
|
if (isSIP) {
|
||||||
if (mFirstSipAddressIndex == -1) {
|
if (mFirstSipAddressIndex == -1) {
|
||||||
mFirstSipAddressIndex = controls.getChildCount();
|
mFirstSipAddressIndex = controls.getChildCount();
|
||||||
}
|
}
|
||||||
displayNumberOrAddress =
|
|
||||||
LinphoneUtils.getDisplayableUsernameFromAddress(numberOrAddress);
|
if (getResources()
|
||||||
|
.getBoolean(R.bool.only_show_address_username_if_matches_default_domain)) {
|
||||||
|
displayedNumberOrAddress =
|
||||||
|
LinphoneUtils.getDisplayableUsernameFromAddress(numberOrAddress);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if ((getResources().getBoolean(R.bool.hide_phone_numbers_in_editor) && !isSIP)
|
if ((getResources().getBoolean(R.bool.hide_phone_numbers_in_editor) && !isSIP)
|
||||||
|| (getResources().getBoolean(R.bool.hide_sip_addresses_in_editor) && isSIP)) {
|
|| (getResources().getBoolean(R.bool.hide_sip_addresses_in_editor) && isSIP)) {
|
||||||
|
@ -591,7 +595,7 @@ public class ContactEditorFragment extends Fragment {
|
||||||
if (!isSIP) {
|
if (!isSIP) {
|
||||||
noa.setInputType(InputType.TYPE_CLASS_PHONE);
|
noa.setInputType(InputType.TYPE_CLASS_PHONE);
|
||||||
}
|
}
|
||||||
noa.setText(displayNumberOrAddress);
|
noa.setText(displayedNumberOrAddress);
|
||||||
noa.addTextChangedListener(
|
noa.addTextChangedListener(
|
||||||
new TextWatcher() {
|
new TextWatcher() {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -121,6 +121,7 @@
|
||||||
<bool name="use_native_contact_editor">false</bool>
|
<bool name="use_native_contact_editor">false</bool>
|
||||||
<bool name="hide_invite_contact">false</bool>
|
<bool name="hide_invite_contact">false</bool>
|
||||||
<bool name="generate_text_avatar">true</bool>
|
<bool name="generate_text_avatar">true</bool>
|
||||||
|
<bool name="only_show_address_username_if_matches_default_domain">true</bool>
|
||||||
|
|
||||||
<!-- Side Menu -->
|
<!-- Side Menu -->
|
||||||
<bool name="hide_assistant_from_side_menu">false</bool>
|
<bool name="hide_assistant_from_side_menu">false</bool>
|
||||||
|
|
Loading…
Reference in a new issue