• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2017 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 
17 package com.android.settings.dashboard.suggestions;
18 
19 import android.content.Context;
20 
21 import com.android.settingslib.SuggestionParser;
22 import com.android.settingslib.drawer.Tile;
23 
24 import java.util.List;
25 
26 /** Interface should be implemented if you have added new suggestions */
27 public interface SuggestionFeatureProvider {
28 
29     /**
30      * Returns true if smart suggestion should be used instead of xml based SuggestionParser.
31      */
isSmartSuggestionEnabled(Context context)32     boolean isSmartSuggestionEnabled(Context context);
33 
34     /** Return true if className is the name of a class of one of your newly added suggestion. */
isPresent(String className)35     boolean isPresent(String className);
36 
37     /** Return true if the suggestion has already been completed and does not need to be shown */
isSuggestionCompleted(Context context)38     boolean isSuggestionCompleted(Context context);
39 
40     /**
41      * Ranks the list of suggestions in place.
42      *
43      * @param suggestions   List of suggestion Tiles
44      * @param suggestionIds List of suggestion ids corresponding to the suggestion tiles.
45      */
rankSuggestions(final List<Tile> suggestions, List<String> suggestionIds)46     void rankSuggestions(final List<Tile> suggestions, List<String> suggestionIds);
47 
48     /**
49      * Dismisses a suggestion.
50      */
dismissSuggestion(Context context, SuggestionParser parser, Tile suggestion)51     void dismissSuggestion(Context context, SuggestionParser parser, Tile suggestion);
52 
53     /**
54      * Returns an identifier for the suggestion
55      */
getSuggestionIdentifier(Context context, Tile suggestion)56     String getSuggestionIdentifier(Context context, Tile suggestion);
57 }
58