Contact display phone numbers + don't reload contacts on back
This commit is contained in:
parent
78f83b9a71
commit
af3d82ae8d
2 changed files with 27 additions and 12 deletions
|
@ -107,17 +107,10 @@ public class ContactsFragment extends Fragment implements OnClickListener, OnIte
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
if (LinphoneActivity.isInstanciated()) {
|
||||
LinphoneActivity.instance().selectMenu(FragmentsAvailable.CONTACTS);
|
||||
}
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
if (contactsList.getAdapter() == null) {
|
||||
cursor = Compatibility.getContactsCursor(getActivity().getContentResolver());
|
||||
contactsList.setAdapter(new ContactsListAdapter());
|
||||
contactsList.setFastScrollEnabled(true);
|
||||
|
||||
contacts = new ArrayList<Contact>();
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
|
@ -130,6 +123,18 @@ public class ContactsFragment extends Fragment implements OnClickListener, OnIte
|
|||
}).start();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
if (LinphoneActivity.isInstanciated()) {
|
||||
LinphoneActivity.instance().selectMenu(FragmentsAvailable.CONTACTS);
|
||||
}
|
||||
|
||||
if (contactsList.getAdapter() == null) {
|
||||
contactsList.setAdapter(new ContactsListAdapter());
|
||||
contactsList.setFastScrollEnabled(true);
|
||||
}
|
||||
|
||||
contactsList.setSelectionFromTop(lastKnownPosition, 0);
|
||||
}
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ import android.content.Intent;
|
|||
import android.database.Cursor;
|
||||
import android.net.Uri;
|
||||
import android.provider.ContactsContract;
|
||||
import android.provider.ContactsContract.CommonDataKinds.Phone;
|
||||
import android.provider.ContactsContract.CommonDataKinds.SipAddress;
|
||||
import android.provider.ContactsContract.Contacts;
|
||||
import android.provider.ContactsContract.Contacts.Data;
|
||||
|
@ -71,6 +72,7 @@ public class ApiFivePlus {
|
|||
Uri uri = ContactsContract.Data.CONTENT_URI;
|
||||
String[] projection = {ContactsContract.CommonDataKinds.Im.DATA};
|
||||
|
||||
// SIP addresses
|
||||
if (Version.sdkAboveOrEqual(Version.API09_GINGERBREAD_23)) {
|
||||
String selection = new StringBuilder()
|
||||
.append(ContactsContract.Data.CONTACT_ID)
|
||||
|
@ -106,6 +108,14 @@ public class ApiFivePlus {
|
|||
c.close();
|
||||
}
|
||||
|
||||
// Phone Numbers
|
||||
Cursor c = cr.query(Phone.CONTENT_URI, null, Phone.CONTACT_ID + " = " + id, null, null);
|
||||
while (c.moveToNext()) {
|
||||
String number = c.getString(c.getColumnIndex(Phone.NUMBER));
|
||||
list.add(number);
|
||||
}
|
||||
c.close();
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue