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 17package com.android.settings.dashboard.suggestions; 18 19import android.content.Context; 20 21import com.android.settingslib.SuggestionParser; 22import com.android.settingslib.drawer.Tile; 23 24import java.util.List; 25 26/** Interface should be implemented if you have added new suggestions */ 27public interface SuggestionFeatureProvider { 28 29 /** 30 * Returns true if smart suggestion should be used instead of xml based SuggestionParser. 31 */ 32 boolean isSmartSuggestionEnabled(Context context); 33 34 /** Return true if className is the name of a class of one of your newly added suggestion. */ 35 boolean isPresent(String className); 36 37 /** Return true if the suggestion has already been completed and does not need to be shown */ 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 */ 46 void rankSuggestions(final List<Tile> suggestions, List<String> suggestionIds); 47 48 /** 49 * Dismisses a suggestion. 50 */ 51 void dismissSuggestion(Context context, SuggestionParser parser, Tile suggestion); 52 53 /** 54 * Returns an identifier for the suggestion 55 */ 56 String getSuggestionIdentifier(Context context, Tile suggestion); 57} 58