Allow multiple SIP addresses in in-app contact editor
This commit is contained in:
parent
4196b5c28b
commit
019e494a53
4 changed files with 21 additions and 14 deletions
|
@ -23,6 +23,7 @@
|
|||
<bool name="use_first_login_activity">true</bool>
|
||||
|
||||
<bool name="use_android_native_contact_edit_interface">false</bool>
|
||||
<!-- The following settings are only usefull if use_android_native_contact_edit_interface = false -->
|
||||
<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>
|
||||
|
|
|
@ -216,8 +216,11 @@ public class ChatStorage {
|
|||
|
||||
Cursor c = db.query(TABLE_NAME, null, null, null, "remoteContact", null, "id DESC");
|
||||
while (c != null && c.moveToNext()) {
|
||||
String remoteContact = c.getString(c.getColumnIndex("remoteContact"));
|
||||
chatList.add(remoteContact);
|
||||
try {
|
||||
String remoteContact = c.getString(c.getColumnIndex("remoteContact"));
|
||||
chatList.add(remoteContact);
|
||||
} catch (IllegalStateException ise) {
|
||||
}
|
||||
}
|
||||
c.close();
|
||||
|
||||
|
|
|
@ -176,7 +176,6 @@ public class EditContactFragment extends Fragment {
|
|||
if (firstSipAddressIndex == -1) {
|
||||
firstSipAddressIndex = controls.getChildCount();
|
||||
}
|
||||
|
||||
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)) {
|
||||
|
@ -212,8 +211,6 @@ public class EditContactFragment extends Fragment {
|
|||
nounoa.delete();
|
||||
numbersAndAddresses.remove(nounoa);
|
||||
view.setVisibility(View.GONE);
|
||||
if (isSip) // Add back the add SIP row
|
||||
addEmptyRowToAllowNewNumberOrAddress(controls, true);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -240,10 +237,8 @@ public class EditContactFragment extends Fragment {
|
|||
}
|
||||
|
||||
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);
|
||||
}
|
||||
firstSipAddressIndex = controls.getChildCount() - 2; // Update the value to always display phone numbers before SIP accounts
|
||||
addEmptyRowToAllowNewNumberOrAddress(controls, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -277,18 +272,20 @@ public class EditContactFragment extends Fragment {
|
|||
public void onClick(View v) {
|
||||
// Add a line, and change add button for a delete button
|
||||
add.setImageResource(R.drawable.list_delete);
|
||||
add.setOnClickListener(new OnClickListener() {
|
||||
ImageView delete = add;
|
||||
delete.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
nounoa.delete();
|
||||
numbersAndAddresses.remove(nounoa);
|
||||
view.setVisibility(View.GONE);
|
||||
if (isSip) // Add back the add SIP row
|
||||
addEmptyRowToAllowNewNumberOrAddress(controls, true);
|
||||
}
|
||||
});
|
||||
if (!isSip) { // Only 1 SIP address / contact
|
||||
if (!isSip) {
|
||||
firstSipAddressIndex++;
|
||||
addEmptyRowToAllowNewNumberOrAddress(controls, false);
|
||||
} else {
|
||||
addEmptyRowToAllowNewNumberOrAddress(controls, true);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -474,6 +471,8 @@ public class EditContactFragment extends Fragment {
|
|||
private void addNewNumber() {
|
||||
if (isNewContact) {
|
||||
if (isSipAddress) {
|
||||
if (newNumberOrAddress.startsWith("sip:"))
|
||||
newNumberOrAddress = newNumberOrAddress.substring(4);
|
||||
Compatibility.addSipAddressToContact(getActivity(), ops, newNumberOrAddress);
|
||||
} else {
|
||||
ops.add(ContentProviderOperation.newInsert(ContactsContract.Data.CONTENT_URI)
|
||||
|
@ -489,6 +488,8 @@ public class EditContactFragment extends Fragment {
|
|||
String rawContactId = findRawContactID(String.valueOf(contactID));
|
||||
|
||||
if (isSipAddress) {
|
||||
if (newNumberOrAddress.startsWith("sip:"))
|
||||
newNumberOrAddress = newNumberOrAddress.substring(4);
|
||||
Compatibility.addSipAddressToContact(getActivity(), ops, newNumberOrAddress, rawContactId);
|
||||
} else {
|
||||
ops.add(ContentProviderOperation.newInsert(ContactsContract.Data.CONTENT_URI)
|
||||
|
@ -505,6 +506,8 @@ public class EditContactFragment extends Fragment {
|
|||
|
||||
private void updateNumber() {
|
||||
if (isSipAddress) {
|
||||
if (newNumberOrAddress.startsWith("sip:"))
|
||||
newNumberOrAddress = newNumberOrAddress.substring(4);
|
||||
Compatibility.updateSipAddressForContact(ops, oldNumberOrAddress, newNumberOrAddress, String.valueOf(contactID));
|
||||
} else {
|
||||
String select = ContactsContract.Data.CONTACT_ID + "=? AND "
|
||||
|
|
|
@ -131,7 +131,7 @@ public class IncomingCallActivity extends Activity implements LinphoneOnCallStat
|
|||
|
||||
private void answer() {
|
||||
LinphoneCallParams params = LinphoneManager.getLc().createDefaultCallParameters();
|
||||
if (mCall != null && mCall.getRemoteParams().getVideoEnabled() && LinphoneManager.getInstance().isAutoAcceptCamera()) {
|
||||
if (mCall != null && mCall.getRemoteParams() != null && mCall.getRemoteParams().getVideoEnabled() && LinphoneManager.isInstanciated() && LinphoneManager.getInstance().isAutoAcceptCamera()) {
|
||||
params.setVideoEnabled(true);
|
||||
} else {
|
||||
params.setVideoEnabled(false);
|
||||
|
|
Loading…
Reference in a new issue