[Issue 2061094] Upgrading ContactDictionary to new API
parent
6a001f58da
commit
41fc8f4a18
|
@ -24,15 +24,14 @@ import android.content.ContentResolver;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.database.ContentObserver;
|
import android.database.ContentObserver;
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
import android.provider.Contacts;
|
import android.provider.ContactsContract.Contacts;
|
||||||
import android.provider.Contacts.People;
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
public class ContactsDictionary extends ExpandableDictionary {
|
public class ContactsDictionary extends ExpandableDictionary {
|
||||||
|
|
||||||
private static final String[] PROJECTION = {
|
private static final String[] PROJECTION = {
|
||||||
People._ID,
|
Contacts._ID,
|
||||||
People.NAME,
|
Contacts.DISPLAY_NAME,
|
||||||
};
|
};
|
||||||
|
|
||||||
private static final int INDEX_NAME = 1;
|
private static final int INDEX_NAME = 1;
|
||||||
|
@ -47,7 +46,7 @@ public class ContactsDictionary extends ExpandableDictionary {
|
||||||
// when needed.
|
// when needed.
|
||||||
ContentResolver cres = context.getContentResolver();
|
ContentResolver cres = context.getContentResolver();
|
||||||
|
|
||||||
cres.registerContentObserver(People.CONTENT_URI, true, mObserver = new ContentObserver(null) {
|
cres.registerContentObserver(Contacts.CONTENT_URI, true, mObserver = new ContentObserver(null) {
|
||||||
@Override
|
@Override
|
||||||
public void onChange(boolean self) {
|
public void onChange(boolean self) {
|
||||||
mRequiresReload = true;
|
mRequiresReload = true;
|
||||||
|
@ -66,7 +65,7 @@ public class ContactsDictionary extends ExpandableDictionary {
|
||||||
|
|
||||||
private synchronized void loadDictionary() {
|
private synchronized void loadDictionary() {
|
||||||
Cursor cursor = getContext().getContentResolver()
|
Cursor cursor = getContext().getContentResolver()
|
||||||
.query(People.CONTENT_URI, PROJECTION, null, null, null);
|
.query(Contacts.CONTENT_URI, PROJECTION, null, null, null);
|
||||||
if (cursor != null) {
|
if (cursor != null) {
|
||||||
addWords(cursor);
|
addWords(cursor);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue