• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2017 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.dialer.contactsfragment;
18 
19 import android.content.Context;
20 import android.content.CursorLoader;
21 import android.provider.ContactsContract.Contacts;
22 
23 /** Cursor Loader for {@link ContactsFragment}. */
24 final class ContactsCursorLoader extends CursorLoader {
25 
26   public static final int CONTACT_ID = 0;
27   public static final int CONTACT_DISPLAY_NAME = 1;
28   public static final int CONTACT_PHOTO_ID = 2;
29   public static final int CONTACT_PHOTO_URI = 3;
30   public static final int CONTACT_LOOKUP_KEY = 4;
31 
32   public static final String[] CONTACTS_PROJECTION =
33       new String[] {
34         Contacts._ID, // 0
35         Contacts.DISPLAY_NAME_PRIMARY, // 1
36         Contacts.PHOTO_ID, // 2
37         Contacts.PHOTO_THUMBNAIL_URI, // 3
38         Contacts.LOOKUP_KEY, // 4
39       };
40 
ContactsCursorLoader(Context context)41   public ContactsCursorLoader(Context context) {
42     super(
43         context,
44         Contacts.CONTENT_URI
45             .buildUpon()
46             .appendQueryParameter(Contacts.EXTRA_ADDRESS_BOOK_INDEX, "true")
47             .build(),
48         CONTACTS_PROJECTION,
49         null,
50         null,
51         Contacts.SORT_KEY_PRIMARY + " ASC");
52   }
53 }
54