1 /*
2  * Copyright (C) 2016 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.settings.search2;
17 
18 import android.app.Activity;
19 import android.content.Context;
20 import android.view.Menu;
21 
22 import android.view.View;
23 import com.android.settings.dashboard.SiteMapManager;
24 import com.android.settings.search.IndexingCallback;
25 
26 /**
27  * FeatureProvider for Settings Search
28  */
29 public interface SearchFeatureProvider {
30 
31     /**
32      * @return true to use the new version of search
33      */
isEnabled(Context context)34     boolean isEnabled(Context context);
35 
36     /**
37      * Inserts the Menu items into Settings activity.
38      *
39      * @param menu Items will be inserted into this menu.
40      * @param activity The activity that precedes SearchActivity.
41      */
setUpSearchMenu(Menu menu, Activity activity)42     void setUpSearchMenu(Menu menu, Activity activity);
43 
44     /**
45      * Returns a new loader to search in index database.
46      */
getDatabaseSearchLoader(Context context, String query)47     DatabaseResultLoader getDatabaseSearchLoader(Context context, String query);
48 
49     /**
50      * Returns a new loader to search installed apps.
51      */
getInstalledAppSearchLoader(Context context, String query)52     InstalledAppResultLoader getInstalledAppSearchLoader(Context context, String query);
53 
54     /**
55      * Returns a new loader to get all recently saved queries search terms.
56      */
getSavedQueryLoader(Context context)57     SavedQueryLoader getSavedQueryLoader(Context context);
58 
59     /**
60      * Returns the manager for indexing Settings data.
61      */
getIndexingManager(Context context)62     DatabaseIndexingManager getIndexingManager(Context context);
63 
64     /**
65      * Returns the manager for looking up breadcrumbs.
66      */
getSiteMapManager()67     SiteMapManager getSiteMapManager();
68 
69     /**
70      * Updates the Settings indexes
71      */
updateIndex(Context context, IndexingCallback callback)72     void updateIndex(Context context, IndexingCallback callback);
73 
74     /**
75      * @returns true when indexing is complete.
76      */
isIndexingComplete(Context context)77     boolean isIndexingComplete(Context context);
78 
79     /**
80      * Initializes the feedback button in case it was dismissed.
81      */
initFeedbackButton()82     default void initFeedbackButton() {
83     }
84 
85     /**
86      * Show a button users can click to submit feedback on the quality of the search results.
87      */
showFeedbackButton(SearchFragment fragment, View view)88     default void showFeedbackButton(SearchFragment fragment, View view) {
89     }
90 
91     /**
92      * Hide the feedback button shown by
93      * {@link #showFeedbackButton(SearchFragment fragment, View view) showFeedbackButton}
94      */
hideFeedbackButton()95     default void hideFeedbackButton() {
96     }
97 
98 
99 }
100