1 /* 2 * Copyright (C) 2022 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 import android.content.ComponentName 19 20 /** Interface for individual suggestions. */ 21 interface Suggestion { 22 /** Gets the source that produced the current suggestion. */ 23 val suggestionSource: com.android.quicksearchbox.Source? 24 25 /** Gets the shortcut ID of the current suggestion. */ 26 val shortcutId: String? 27 28 /** Whether to show a spinner while refreshing this shortcut. */ 29 val isSpinnerWhileRefreshing: Boolean 30 31 /** 32 * Gets the format of the text returned by [.getSuggestionText1] and [.getSuggestionText2]. 33 * 34 * @return `null` or "html" 35 */ 36 val suggestionFormat: String? 37 38 /** Gets the first text line for the current suggestion. */ 39 val suggestionText1: String? 40 41 /** Gets the second text line for the current suggestion. */ 42 val suggestionText2: String? 43 44 /** Gets the second text line URL for the current suggestion. */ 45 val suggestionText2Url: String? 46 47 /** 48 * Gets the left-hand-side icon for the current suggestion. 49 * 50 * @return A string that can be passed to [Source.getIcon]. 51 */ 52 val suggestionIcon1: String? 53 54 /** 55 * Gets the right-hand-side icon for the current suggestion. 56 * 57 * @return A string that can be passed to [Source.getIcon]. 58 */ 59 val suggestionIcon2: String? 60 61 /** Gets the intent action for the current suggestion. */ 62 val suggestionIntentAction: String? 63 64 /** Gets the name of the activity that the intent for the current suggestion will be sent to. */ 65 val suggestionIntentComponent: ComponentName? 66 67 /** Gets the extra data associated with this suggestion's intent. */ 68 val suggestionIntentExtraData: String? 69 70 /** Gets the data associated with this suggestion's intent. */ 71 val suggestionIntentDataString: String? 72 73 /** Gets the query associated with this suggestion's intent. */ 74 val suggestionQuery: String? 75 76 /** 77 * Gets the suggestion log type for the current suggestion. This is logged together with the value 78 * returned from [Source.getName]. The value is source-specific. Most sources return `null`. 79 */ 80 val suggestionLogType: String? 81 82 /** Checks if this suggestion is a shortcut. */ 83 val isSuggestionShortcut: Boolean 84 85 /** Checks if this is a web search suggestion. */ 86 val isWebSearchSuggestion: Boolean 87 88 /** Checks whether this suggestion comes from the user's search history. */ 89 val isHistorySuggestion: Boolean 90 91 /** Returns any extras associated with this suggestion, or `null` if there are none. */ 92 val extras: com.android.quicksearchbox.SuggestionExtras? 93 } 94