MockShortcutRepository.java revision 3e44ff1f2a204db3f479698cf0b3eab3d451dec2
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 android.content.ComponentName; 20 21import java.util.ArrayList; 22import java.util.List; 23 24/** 25 * Mock implementation of {@link ShortcutRepository}. 26 * 27 */ 28public class MockShortcutRepository implements ShortcutRepository { 29 30 public void clearHistory() { 31 } 32 33 public void close() { 34 } 35 36 public SuggestionCursor getShortcutsForQuery(String query) { 37 DataSuggestionCursor cursor = new DataSuggestionCursor(query); 38 SuggestionData s1 = new SuggestionData.Builder(MockSource.SOURCE_1) 39 .text1(query + "_1_shortcut") 40 .displayQuery(query + "_1_shortcut") 41 .build(); 42 SuggestionData s2 = new SuggestionData.Builder(MockSource.SOURCE_2) 43 .text1(query + "_2_shortcut") 44 .displayQuery(query + "_2_shortcut") 45 .build(); 46 cursor.add(s1); 47 cursor.add(s2); 48 return cursor; 49 } 50 51 public ArrayList<ComponentName> getSourceRanking() { 52 return null; 53 } 54 55 public boolean hasHistory() { 56 return false; 57 } 58 59 public void refreshShortcut(ComponentName source, String shortcutId, 60 SuggestionPosition refreshed) { 61 } 62 63 public void reportClick(SuggestionPosition clicked) { 64 } 65 66 public void reportImpressions(List<SuggestionPosition> impressions) { 67 } 68 69} 70