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.database.Cursor; 20 import android.support.annotation.NonNull; 21 22 /** Base cursor interface needed for all cursors used in search. */ 23 public interface SearchCursor extends Cursor { 24 25 String[] HEADER_PROJECTION = {"header_text"}; 26 27 int HEADER_TEXT_POSITION = 0; 28 29 /** Returns true if the current cursor position is a header */ isHeader()30 boolean isHeader(); 31 32 /** 33 * Notifies the cursor that the query has updated. 34 * 35 * @return true if the data set has changed. 36 */ updateQuery(@onNull String query)37 boolean updateQuery(@NonNull String query); 38 39 /** 40 * Returns an ID unique to the directory this cursor reads from. Generally this value will be 41 * related to {@link android.provider.ContactsContract.Directory} but could differ depending on 42 * the implementation. 43 */ getDirectoryId()44 long getDirectoryId(); 45 } 46