• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.
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 rounded icon.
51      * @param sourceMetricsCategory The context (source) from which an action is performed
52      * @param pref The preference to bind data
53      * @param tile The binding data
54      * @param key They key for preference. If null, we will generate one from tile data
55      * @param baseOrder The order offset value. When binding, pref's order is determined by
56      * both this value and tile's own priority.
57      */
bindPreferenceToTile(FragmentActivity activity, boolean forceRoundedIcon, int sourceMetricsCategory, Preference pref, Tile tile, String key, int baseOrder)58     void bindPreferenceToTile(FragmentActivity activity, boolean forceRoundedIcon,
59             int sourceMetricsCategory, Preference pref, Tile tile, String key, int baseOrder);
60 
61     /**
62      * Opens a tile to its destination intent.
63      */
openTileIntent(FragmentActivity activity, Tile tile)64     void openTileIntent(FragmentActivity activity, Tile tile);
65 
66 }
67