Home | History | Annotate | Download | only in quicksearchbox
      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 
     17 package com.android.quicksearchbox;
     18 
     19 import android.content.Intent;
     20 import android.graphics.drawable.Drawable;
     21 import android.net.Uri;
     22 import android.os.Bundle;
     23 
     24 import 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  */
     33 public 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     /**
     61      * @return The minimum query length for which this corpus should be queried.
     62      */
     63     int getQueryThreshold();
     64 
     65     boolean queryAfterZeroResults();
     66 
     67     boolean voiceSearchEnabled();
     68 
     69     Intent createSearchIntent(String query, Bundle appData);
     70 
     71     Intent createVoiceSearchIntent(Bundle appData);
     72 
     73     boolean isWebCorpus();
     74 
     75     /**
     76      * Gets the sources that this corpus uses.
     77      */
     78     Collection<Source> getSources();
     79 
     80     /**
     81      * Checks if this corpus is enabled by default.
     82      */
     83     boolean isCorpusDefaultEnabled();
     84 
     85     /**
     86      * Whether this corpus should be included in the blended All mode.
     87      */
     88     boolean includeInAll();
     89 
     90     /**
     91      * Checks if this corpus should be hidden from the corpus selector.
     92      */
     93     boolean isCorpusHidden();
     94 
     95 }
     96