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.dashboard; 17 18 import androidx.fragment.app.FragmentActivity; 19 import androidx.preference.Preference; 20 21 import com.android.settingslib.drawer.DashboardCategory; 22 import com.android.settingslib.drawer.Tile; 23 24 import java.util.List; 25 26 /** 27 * FeatureProvider for dashboard (aka settings homepage). 28 */ 29 public interface DashboardFeatureProvider { 30 31 /** 32 * Get tiles (wrapped in {@link DashboardCategory}) for key defined in CategoryKey. 33 */ getTilesForCategory(String key)34 DashboardCategory getTilesForCategory(String key); 35 36 /** 37 * Get all tiles, grouped by category. 38 */ getAllCategories()39 List<DashboardCategory> getAllCategories(); 40 41 /** 42 * Returns an unique string key for the tile. 43 */ getDashboardKeyForTile(Tile tile)44 String getDashboardKeyForTile(Tile tile); 45 46 /** 47 * Binds preference to data provided by tile and gets dynamic data observers. 48 * 49 * @param activity If tile contains intent to launch, it will be launched from this activity 50 * @param forceRoundedIcon Whether or not injected tiles from other packages should be forced to 51 * rounded icon. 52 * @param sourceMetricsCategory The context (source) from which an action is performed 53 * @param pref The preference to bind data 54 * @param tile The binding data 55 * @param key They key for preference. If null, we will generate one from tile data 56 * @param baseOrder The order offset value. When binding, pref's order is determined by 57 * both this value and tile's own priority. 58 * @return The list of dynamic data observers 59 */ bindPreferenceToTileAndGetObservers(FragmentActivity activity, boolean forceRoundedIcon, int sourceMetricsCategory, Preference pref, Tile tile, String key, int baseOrder)60 List<DynamicDataObserver> bindPreferenceToTileAndGetObservers(FragmentActivity activity, 61 boolean forceRoundedIcon, int sourceMetricsCategory, Preference pref, Tile tile, 62 String key, int baseOrder); 63 64 /** 65 * Opens a tile to its destination intent. 66 */ openTileIntent(FragmentActivity activity, Tile tile)67 void openTileIntent(FragmentActivity activity, Tile tile); 68 69 } 70