Home | History | Annotate | Download | only in common
      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.searchfragment.common;
     18 
     19 import android.provider.ContactsContract.CommonDataKinds.Phone;
     20 import android.provider.ContactsContract.Data;
     21 
     22 /** Class containing relevant projections for searching contacts. */
     23 public class Projections {
     24 
     25   public static final int ID = 0;
     26   public static final int PHONE_TYPE = 1;
     27   public static final int PHONE_LABEL = 2;
     28   public static final int PHONE_NUMBER = 3;
     29   public static final int DISPLAY_NAME = 4;
     30   public static final int PHOTO_ID = 5;
     31   public static final int PHOTO_URI = 6;
     32   public static final int LOOKUP_KEY = 7;
     33   public static final int CARRIER_PRESENCE = 8;
     34   public static final int CONTACT_ID = 9;
     35 
     36   @SuppressWarnings("unused")
     37   public static final int SORT_KEY = 10;
     38 
     39   public static final int SORT_ALTERNATIVE = 11;
     40   public static final int MIME_TYPE = 12;
     41   public static final int COMPANY_NAME = 13;
     42   public static final int NICKNAME = 14;
     43 
     44   public static final String[] CP2_PROJECTION =
     45       new String[] {
     46         Phone._ID, // 0
     47         Phone.TYPE, // 1
     48         Phone.LABEL, // 2
     49         Phone.NUMBER, // 3
     50         Phone.DISPLAY_NAME_PRIMARY, // 4
     51         Phone.PHOTO_ID, // 5
     52         Phone.PHOTO_THUMBNAIL_URI, // 6
     53         Phone.LOOKUP_KEY, // 7
     54         Phone.CARRIER_PRESENCE, // 8
     55         Phone.CONTACT_ID, // 9
     56         Phone.SORT_KEY_PRIMARY, // 10
     57         Phone.SORT_KEY_ALTERNATIVE, // 11
     58         // Data.MIMETYPE, // 12
     59         // Organization.COMPANY, // 13
     60         // Nickname.NAME // 14
     61       };
     62 
     63   // Uses alternative display names (i.e. "Bob Dylan" becomes "Dylan, Bob").
     64   public static final String[] CP2_PROJECTION_ALTERNATIVE =
     65       new String[] {
     66         Data._ID, // 0
     67         Phone.TYPE, // 1
     68         Phone.LABEL, // 2
     69         Phone.NUMBER, // 3
     70         Data.DISPLAY_NAME_ALTERNATIVE, // 4
     71         Data.PHOTO_ID, // 5
     72         Data.PHOTO_THUMBNAIL_URI, // 6
     73         Data.LOOKUP_KEY, // 7
     74         Data.CARRIER_PRESENCE, // 8
     75         Data.CONTACT_ID, // 9
     76         Data.SORT_KEY_PRIMARY, // 11
     77         Data.SORT_KEY_ALTERNATIVE, // 12
     78         // Data.MIMETYPE, // 12
     79         // Organization.COMPANY, // 13
     80         // Nickname.NAME // 14
     81       };
     82 
     83   public static final String[] DATA_PROJECTION =
     84       new String[] {
     85         Data._ID, // 0
     86         Phone.TYPE, // 1
     87         Phone.LABEL, // 2
     88         Phone.NUMBER, // 3
     89         Data.DISPLAY_NAME_PRIMARY, // 4
     90         Data.PHOTO_ID, // 5
     91         Data.PHOTO_THUMBNAIL_URI, // 6
     92         Data.LOOKUP_KEY, // 7
     93         Data.CARRIER_PRESENCE, // 8
     94         Data.CONTACT_ID, // 9
     95         Data.MIMETYPE, // 10
     96         Data.SORT_KEY_PRIMARY, // 11
     97       };
     98 }
     99