1 /* 2 * Copyright (C) 2010 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 package com.android.quicksearchbox; 17 18 /** 19 * Interface for individual suggestions. 20 */ 21 public interface Suggestion { 22 23 /** 24 * Gets the source that produced the current suggestion. 25 */ getSuggestionSource()26 Source getSuggestionSource(); 27 28 /** 29 * Gets the shortcut ID of the current suggestion. 30 */ getShortcutId()31 String getShortcutId(); 32 33 /** 34 * Whether to show a spinner while refreshing this shortcut. 35 */ isSpinnerWhileRefreshing()36 boolean isSpinnerWhileRefreshing(); 37 38 /** 39 * Gets the format of the text returned by {@link #getSuggestionText1()} 40 * and {@link #getSuggestionText2()}. 41 * 42 * @return {@code null} or "html" 43 */ getSuggestionFormat()44 String getSuggestionFormat(); 45 46 /** 47 * Gets the first text line for the current suggestion. 48 */ getSuggestionText1()49 String getSuggestionText1(); 50 51 /** 52 * Gets the second text line for the current suggestion. 53 */ getSuggestionText2()54 String getSuggestionText2(); 55 56 /** 57 * Gets the second text line URL for the current suggestion. 58 */ getSuggestionText2Url()59 String getSuggestionText2Url(); 60 61 /** 62 * Gets the left-hand-side icon for the current suggestion. 63 * 64 * @return A string that can be passed to {@link Source#getIcon(String)}. 65 */ getSuggestionIcon1()66 String getSuggestionIcon1(); 67 68 /** 69 * Gets the right-hand-side icon for the current suggestion. 70 * 71 * @return A string that can be passed to {@link Source#getIcon(String)}. 72 */ getSuggestionIcon2()73 String getSuggestionIcon2(); 74 75 /** 76 * Gets the intent action for the current suggestion. 77 */ getSuggestionIntentAction()78 String getSuggestionIntentAction(); 79 80 /** 81 * Gets the extra data associated with this suggestion's intent. 82 */ getSuggestionIntentExtraData()83 String getSuggestionIntentExtraData(); 84 85 /** 86 * Gets the data associated with this suggestion's intent. 87 */ getSuggestionIntentDataString()88 String getSuggestionIntentDataString(); 89 90 /** 91 * Gets the query associated with this suggestion's intent. 92 */ getSuggestionQuery()93 String getSuggestionQuery(); 94 95 /** 96 * Gets the suggestion log type for the current suggestion. This is logged together 97 * with the value returned from {@link Source#getName()}. 98 * The value is source-specific. Most sources return {@code null}. 99 */ getSuggestionLogType()100 String getSuggestionLogType(); 101 102 /** 103 * Checks if this suggestion is a shortcut. 104 */ isSuggestionShortcut()105 boolean isSuggestionShortcut(); 106 107 /** 108 * Checks if this is a web search suggestion. 109 */ isWebSearchSuggestion()110 boolean isWebSearchSuggestion(); 111 112 } 113