Put sip address before numbers in contact view

This commit is contained in:
Margaux Clerc 2015-11-25 16:51:10 +01:00
parent 1fe56c1510
commit 0e4b5d7d0b
3 changed files with 23 additions and 24 deletions

View file

@ -27,7 +27,6 @@ import java.util.ArrayList;
import java.util.List;
import org.linphone.compatibility.Compatibility;
import org.linphone.core.LinphoneProxyConfig;
import org.linphone.mediastream.Log;
import org.linphone.mediastream.Version;
import android.annotation.SuppressLint;
import android.app.Activity;
@ -109,7 +108,7 @@ public class ContactEditorFragment extends Fragment {
contactsManager = ContactsManager.getInstance();
view = inflater.inflate(R.layout.edit_contact, container, false);
view = inflater.inflate(R.layout.contact_edit, container, false);
ImageView back = (ImageView) view.findViewById(R.id.back);
back.setOnClickListener(new OnClickListener() {

View file

@ -102,16 +102,6 @@ public class ApiFivePlus {
Uri uri = Data.CONTENT_URI;
String[] projection = {ContactsContract.CommonDataKinds.Im.DATA};
// Phone Numbers
Cursor c = cr.query(Phone.CONTENT_URI, new String[] { Phone.NUMBER }, Phone.CONTACT_ID + " = " + id, null, null);
if (c != null) {
while (c.moveToNext()) {
String number = c.getString(c.getColumnIndex(Phone.NUMBER));
list.add(number);
}
c.close();
}
// IM addresses
String selection = new StringBuilder()
@ -122,7 +112,7 @@ public class ApiFivePlus {
.append(ContactsContract.CommonDataKinds.Im.CUSTOM_PROTOCOL)
.append(") = 'sip'")
.toString();
c = cr.query(uri, projection, selection, new String[]{id}, null);
Cursor c = cr.query(uri, projection, selection, new String[]{id}, null);
if (c != null) {
int nbId = c.getColumnIndex(ContactsContract.CommonDataKinds.Im.DATA);
while (c.moveToNext()) {
@ -131,6 +121,16 @@ public class ApiFivePlus {
c.close();
}
// Phone Numbers
c = cr.query(Phone.CONTENT_URI, new String[]{Phone.NUMBER}, Phone.CONTACT_ID + " = " + id, null, null);
if (c != null) {
while (c.moveToNext()) {
String number = c.getString(c.getColumnIndex(Phone.NUMBER));
list.add(number);
}
c.close();
}
return list;
}

View file

@ -99,16 +99,6 @@ public class ApiNinePlus {
Uri uri = Data.CONTENT_URI;
String[] projection;
// Phone Numbers
Cursor c = cr.query(Phone.CONTENT_URI, new String[] { Phone.NUMBER }, Phone.CONTACT_ID + " = " + id, null, null);
if (c != null) {
while (c.moveToNext()) {
String number = c.getString(c.getColumnIndex(Phone.NUMBER));
list.add(number);
}
c.close();
}
// SIP addresses
String selection2 = new StringBuilder()
.append(Data.CONTACT_ID)
@ -119,7 +109,7 @@ public class ApiNinePlus {
.append("'")
.toString();
projection = new String[] {ContactsContract.CommonDataKinds.SipAddress.SIP_ADDRESS};
c = cr.query(uri, projection, selection2, new String[]{id}, null);
Cursor c = cr.query(uri, projection, selection2, new String[]{id}, null);
if (c != null) {
int nbid = c.getColumnIndex(ContactsContract.CommonDataKinds.SipAddress.SIP_ADDRESS);
while (c.moveToNext()) {
@ -128,6 +118,16 @@ public class ApiNinePlus {
c.close();
}
// Phone Numbers
c = cr.query(Phone.CONTENT_URI, new String[] { Phone.NUMBER }, Phone.CONTACT_ID + " = " + id, null, null);
if (c != null) {
while (c.moveToNext()) {
String number = c.getString(c.getColumnIndex(Phone.NUMBER));
list.add(number);
}
c.close();
}
return list;
}