Corpus.java revision fde948e69f59589cf0d217ea414af7947de600bb
1/* 2 * Copyright (C) 2009 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 17package com.android.quicksearchbox; 18 19import android.content.Intent; 20import android.graphics.drawable.Drawable; 21import android.net.Uri; 22import android.os.Bundle; 23 24/** 25 * A corpus is a user-visible set of suggestions. A corpus gets suggestions from one 26 * or more sources. 27 * 28 * Objects that implement this interface should override {@link Object#equals(Object)} 29 * and {@link Object#hashCode()} so that they can be used as keys in hash maps. 30 */ 31public interface Corpus { 32 33 /** 34 * Gets the localized, human-readable label for this corpus. 35 */ 36 CharSequence getLabel(); 37 38 /** 39 * Gets the icon for this corpus. 40 */ 41 Drawable getCorpusIcon(); 42 43 /** 44 * Gets the icon URI for this corpus. 45 */ 46 Uri getCorpusIconUri(); 47 48 /** 49 * Gets the description to use for this corpus in system search settings. 50 */ 51 CharSequence getSettingsDescription(); 52 53 /** 54 * Gets suggestions from this corpus. 55 * 56 * @param query The user query. 57 * @param queryLimit An advisory maximum number of results that the source should return. 58 * @return The suggestion results. 59 */ 60 CorpusResult getSuggestions(String query, int queryLimit); 61 62 /** 63 * Gets the unique name for this corpus. 64 */ 65 String getName(); 66 67 int getQueryThreshold(); 68 69 boolean queryAfterZeroResults(); 70 71 boolean voiceSearchEnabled(); 72 73 Intent createSearchIntent(String query, Bundle appData); 74 75 Intent createVoiceSearchIntent(Bundle appData); 76 77 boolean isWebCorpus(); 78} 79