New bools to customize in-app contact editor
This commit is contained in:
parent
b9e2d34434
commit
4196b5c28b
2 changed files with 28 additions and 4 deletions
|
@ -23,6 +23,9 @@
|
||||||
<bool name="use_first_login_activity">true</bool>
|
<bool name="use_first_login_activity">true</bool>
|
||||||
|
|
||||||
<bool name="use_android_native_contact_edit_interface">false</bool>
|
<bool name="use_android_native_contact_edit_interface">false</bool>
|
||||||
|
<bool name="hide_phone_numbers_in_editor">false</bool>
|
||||||
|
<bool name="hide_sip_addresses_in_editor">false</bool>
|
||||||
|
<bool name="forbid_empty_new_contact_in_editor">false</bool>
|
||||||
|
|
||||||
<bool name="disable_animations">false</bool>
|
<bool name="disable_animations">false</bool>
|
||||||
<bool name="show_statusbar_only_on_dialer">true</bool>
|
<bool name="show_statusbar_only_on_dialer">true</bool>
|
||||||
|
|
|
@ -63,6 +63,19 @@ public class EditContactFragment extends Fragment {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
if (isNewContact) {
|
if (isNewContact) {
|
||||||
|
if (getResources().getBoolean(R.bool.forbid_empty_new_contact_in_editor)) {
|
||||||
|
boolean areAllFielsEmpty = true;
|
||||||
|
for (NewOrUpdatedNumberOrAddress nounoa : numbersAndAddresses) {
|
||||||
|
if (nounoa.newNumberOrAddress != null && !nounoa.newNumberOrAddress.equals("")) {
|
||||||
|
areAllFielsEmpty = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (areAllFielsEmpty) {
|
||||||
|
getFragmentManager().popBackStackImmediate();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
createNewContact();
|
createNewContact();
|
||||||
} else {
|
} else {
|
||||||
updateExistingContact();
|
updateExistingContact();
|
||||||
|
@ -166,6 +179,9 @@ public class EditContactFragment extends Fragment {
|
||||||
|
|
||||||
numberOrAddress = numberOrAddress.replace("sip:", "");
|
numberOrAddress = numberOrAddress.replace("sip:", "");
|
||||||
}
|
}
|
||||||
|
if ((getResources().getBoolean(R.bool.hide_phone_numbers_in_editor) && !isSip) || (getResources().getBoolean(R.bool.hide_sip_addresses_in_editor) && isSip)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
final NewOrUpdatedNumberOrAddress nounoa = new NewOrUpdatedNumberOrAddress(numberOrAddress, isSip);
|
final NewOrUpdatedNumberOrAddress nounoa = new NewOrUpdatedNumberOrAddress(numberOrAddress, isSip);
|
||||||
numbersAndAddresses.add(nounoa);
|
numbersAndAddresses.add(nounoa);
|
||||||
|
@ -219,10 +235,15 @@ public class EditContactFragment extends Fragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add one for phone numbers, one for SIP address
|
// Add one for phone numbers, one for SIP address
|
||||||
addEmptyRowToAllowNewNumberOrAddress(controls, false);
|
if (!getResources().getBoolean(R.bool.hide_phone_numbers_in_editor)) {
|
||||||
if (firstSipAddressIndex == -1) { // Only add new SIP address field if there is no SIP address yet
|
addEmptyRowToAllowNewNumberOrAddress(controls, false);
|
||||||
firstSipAddressIndex = controls.getChildCount() - 2; // Update the value to alwas display phone numbers before SIP accounts
|
}
|
||||||
addEmptyRowToAllowNewNumberOrAddress(controls, true);
|
|
||||||
|
if (!getResources().getBoolean(R.bool.hide_sip_addresses_in_editor)) {
|
||||||
|
if (firstSipAddressIndex == -1) { // Only add new SIP address field if there is no SIP address yet
|
||||||
|
firstSipAddressIndex = controls.getChildCount() - 2; // Update the value to alwas display phone numbers before SIP accounts
|
||||||
|
addEmptyRowToAllowNewNumberOrAddress(controls, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue