Suggestion.java revision 93bd2e70b8b08da1ec37fd0e990dac05551d2e90
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 */
16package com.android.quicksearchbox;
17
18/**
19 * Interface for individual suggestions.
20 */
21public interface Suggestion {
22
23    /**
24     * Gets the source that produced the current suggestion.
25     */
26    Source getSuggestionSource();
27
28    /**
29     * Gets the shortcut ID of the current suggestion.
30     */
31    String getShortcutId();
32
33    /**
34     * Whether to show a spinner while refreshing this shortcut.
35     */
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     */
44    String getSuggestionFormat();
45
46    /**
47     * Gets the first text line for the current suggestion.
48     */
49    String getSuggestionText1();
50
51    /**
52     * Gets the second text line for the current suggestion.
53     */
54    String getSuggestionText2();
55
56    /**
57     * Gets the second text line URL for the current suggestion.
58     */
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     */
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     */
73    String getSuggestionIcon2();
74
75    /**
76     * Gets the intent action for the current suggestion.
77     */
78    String getSuggestionIntentAction();
79
80    /**
81     * Gets the extra data associated with this suggestion's intent.
82     */
83    String getSuggestionIntentExtraData();
84
85    /**
86     * Gets the data associated with this suggestion's intent.
87     */
88    String getSuggestionIntentDataString();
89
90    /**
91     * Gets the query associated with this suggestion's intent.
92     */
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     */
100    String getSuggestionLogType();
101
102    /**
103     * Checks if this suggestion is a shortcut.
104     */
105    boolean isSuggestionShortcut();
106
107    /**
108     * Checks if this is a web search suggestion.
109     */
110    boolean isWebSearchSuggestion();
111
112}
113