blob: f058c1de655145f08c2a98754137839cd3880447 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
package cgeo.geocaching.search;
import cgeo.geocaching.Intents;
import org.eclipse.jdt.annotation.NonNull;
import android.app.SearchManager;
import android.database.MatrixCursor;
import android.provider.BaseColumns;
/**
* Fixed fields cursor holding the necessary data for the search provider of the global search bar.
*
*/
public class SearchSuggestionCursor extends MatrixCursor {
/**
* id of the row for callbacks after selection
*/
private int rowId = 0;
public SearchSuggestionCursor() {
super(new String[] {
BaseColumns._ID,
SearchManager.SUGGEST_COLUMN_TEXT_1,
SearchManager.SUGGEST_COLUMN_TEXT_2,
SearchManager.SUGGEST_COLUMN_INTENT_ACTION,
SearchManager.SUGGEST_COLUMN_QUERY });
}
public void addCache(@NonNull final String geocode, @NonNull final String name) {
addRow(new String[] {
String.valueOf(rowId),
name,
geocode,
Intents.ACTION_GEOCACHE,
geocode
});
rowId++;
}
}
|