[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.database.ContentObserver;
|
||||
import android.database.Cursor;
|
||||
import android.provider.Contacts;
|
||||
import android.provider.Contacts.People;
|
||||
import android.provider.ContactsContract.Contacts;
|
||||
import android.util.Log;
|
||||
|
||||
public class ContactsDictionary extends ExpandableDictionary {
|
||||
|
||||
private static final String[] PROJECTION = {
|
||||
People._ID,
|
||||
People.NAME,
|
||||
Contacts._ID,
|
||||
Contacts.DISPLAY_NAME,
|
||||
};
|
||||
|
||||
private static final int INDEX_NAME = 1;
|
||||
|
@ -47,7 +46,7 @@ public class ContactsDictionary extends ExpandableDictionary {
|
|||
// when needed.
|
||||
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
|
||||
public void onChange(boolean self) {
|
||||
mRequiresReload = true;
|
||||
|
@ -66,7 +65,7 @@ public class ContactsDictionary extends ExpandableDictionary {
|
|||
|
||||
private synchronized void loadDictionary() {
|
||||
Cursor cursor = getContext().getContentResolver()
|
||||
.query(People.CONTENT_URI, PROJECTION, null, null, null);
|
||||
.query(Contacts.CONTENT_URI, PROJECTION, null, null, null);
|
||||
if (cursor != null) {
|
||||
addWords(cursor);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue