MockShortcutRepository.java revision 6d5cbd67f7a5f824babb5c892b0f30bfd9f4ff23
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
17package com.android.quicksearchbox;
18
19import java.util.List;
20import java.util.Map;
21
22/**
23 * Mock implementation of {@link ShortcutRepository}.
24 *
25 */
26public class MockShortcutRepository implements ShortcutRepository {
27
28    public void clearHistory() {
29    }
30
31    public void close() {
32    }
33
34    public SuggestionCursor getShortcutsForQuery(String query, List<Corpus> corporaToQuery,
35            int maxShortcuts) {
36        // TODO: should look at corporaToQuery
37        DataSuggestionCursor cursor = new DataSuggestionCursor(query);
38        SuggestionData s1 = new SuggestionData(MockSource.SOURCE_1);
39        s1.setText1(query + "_1_shortcut");
40        SuggestionData s2 = new SuggestionData(MockSource.SOURCE_2);
41        s2.setText1(query + "_2_shortcut");
42        cursor.add(s1);
43        cursor.add(s2);
44        return cursor;
45    }
46
47    public Map<String, Integer> getCorpusScores() {
48        return null;
49    }
50
51    public boolean hasHistory() {
52        return false;
53    }
54
55    public void reportClick(SuggestionCursor suggestions, int position) {
56    }
57
58}
59