Corpus.java revision f252dc7a25ba08b973ecc1cfbbce58eb78d42167
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 24import java.util.Collection; 25 26/** 27 * A corpus is a user-visible set of suggestions. A corpus gets suggestions from one 28 * or more sources. 29 * 30 * Objects that implement this interface should override {@link Object#equals(Object)} 31 * and {@link Object#hashCode()} so that they can be used as keys in hash maps. 32 */ 33public interface Corpus extends SuggestionCursorProvider<CorpusResult> { 34 35 /** 36 * Gets the localized, human-readable label for this corpus. 37 */ 38 CharSequence getLabel(); 39 40 /** 41 * Gets the icon for this corpus. 42 */ 43 Drawable getCorpusIcon(); 44 45 /** 46 * Gets the icon URI for this corpus. 47 */ 48 Uri getCorpusIconUri(); 49 50 /** 51 * Gets the description to use for this corpus in system search settings. 52 */ 53 CharSequence getSettingsDescription(); 54 55 /** 56 * Gets the search hint text for this corpus. 57 */ 58 CharSequence getHint(); 59 60 int getQueryThreshold(); 61 62 boolean queryAfterZeroResults(); 63 64 boolean voiceSearchEnabled(); 65 66 Intent createSearchIntent(String query, Bundle appData); 67 68 Intent createVoiceSearchIntent(Bundle appData); 69 70 SuggestionData createSearchShortcut(String query); 71 72 boolean isWebCorpus(); 73 74 /** 75 * Gets the sources that this corpus uses. 76 */ 77 Collection<Source> getSources(); 78} 79