Put sip address before numbers in contact view
This commit is contained in:
parent
1fe56c1510
commit
0e4b5d7d0b
3 changed files with 23 additions and 24 deletions
|
@ -27,7 +27,6 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.linphone.compatibility.Compatibility;
|
import org.linphone.compatibility.Compatibility;
|
||||||
import org.linphone.core.LinphoneProxyConfig;
|
import org.linphone.core.LinphoneProxyConfig;
|
||||||
import org.linphone.mediastream.Log;
|
|
||||||
import org.linphone.mediastream.Version;
|
import org.linphone.mediastream.Version;
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
@ -109,7 +108,7 @@ public class ContactEditorFragment extends Fragment {
|
||||||
|
|
||||||
contactsManager = ContactsManager.getInstance();
|
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);
|
ImageView back = (ImageView) view.findViewById(R.id.back);
|
||||||
back.setOnClickListener(new OnClickListener() {
|
back.setOnClickListener(new OnClickListener() {
|
||||||
|
|
|
@ -102,16 +102,6 @@ public class ApiFivePlus {
|
||||||
|
|
||||||
Uri uri = Data.CONTENT_URI;
|
Uri uri = Data.CONTENT_URI;
|
||||||
String[] projection = {ContactsContract.CommonDataKinds.Im.DATA};
|
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
|
// IM addresses
|
||||||
String selection = new StringBuilder()
|
String selection = new StringBuilder()
|
||||||
|
@ -122,7 +112,7 @@ public class ApiFivePlus {
|
||||||
.append(ContactsContract.CommonDataKinds.Im.CUSTOM_PROTOCOL)
|
.append(ContactsContract.CommonDataKinds.Im.CUSTOM_PROTOCOL)
|
||||||
.append(") = 'sip'")
|
.append(") = 'sip'")
|
||||||
.toString();
|
.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) {
|
if (c != null) {
|
||||||
int nbId = c.getColumnIndex(ContactsContract.CommonDataKinds.Im.DATA);
|
int nbId = c.getColumnIndex(ContactsContract.CommonDataKinds.Im.DATA);
|
||||||
while (c.moveToNext()) {
|
while (c.moveToNext()) {
|
||||||
|
@ -131,6 +121,16 @@ public class ApiFivePlus {
|
||||||
c.close();
|
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;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -99,16 +99,6 @@ public class ApiNinePlus {
|
||||||
Uri uri = Data.CONTENT_URI;
|
Uri uri = Data.CONTENT_URI;
|
||||||
String[] projection;
|
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
|
// SIP addresses
|
||||||
String selection2 = new StringBuilder()
|
String selection2 = new StringBuilder()
|
||||||
.append(Data.CONTACT_ID)
|
.append(Data.CONTACT_ID)
|
||||||
|
@ -119,7 +109,7 @@ public class ApiNinePlus {
|
||||||
.append("'")
|
.append("'")
|
||||||
.toString();
|
.toString();
|
||||||
projection = new String[] {ContactsContract.CommonDataKinds.SipAddress.SIP_ADDRESS};
|
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) {
|
if (c != null) {
|
||||||
int nbid = c.getColumnIndex(ContactsContract.CommonDataKinds.SipAddress.SIP_ADDRESS);
|
int nbid = c.getColumnIndex(ContactsContract.CommonDataKinds.SipAddress.SIP_ADDRESS);
|
||||||
while (c.moveToNext()) {
|
while (c.moveToNext()) {
|
||||||
|
@ -128,6 +118,16 @@ public class ApiNinePlus {
|
||||||
c.close();
|
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;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue