use of com.android.settingslib.drawer.Tile in project android_packages_apps_Settings by crdroidandroid.
the class SummaryLoaderTest method testUpdateSummaryToCache_hasCache_shouldUpdate.
@Test
public void testUpdateSummaryToCache_hasCache_shouldUpdate() {
final String testSummary = "test_summary";
final DashboardCategory category = new DashboardCategory();
final Tile tile = new Tile();
tile.key = "123";
tile.intent = new Intent();
category.addTile(tile);
when(mFeatureFactory.dashboardFeatureProvider.getDashboardKeyForTile(tile)).thenReturn(tile.key);
mSummaryLoader.updateSummaryIfNeeded(tile, testSummary);
tile.summary = null;
mSummaryLoader.updateSummaryToCache(category);
assertThat(tile.summary).isEqualTo(testSummary);
}
use of com.android.settingslib.drawer.Tile in project android_packages_apps_Settings by crdroidandroid.
the class SuggestionAdapterTest method makeSuggestions.
private List<Tile> makeSuggestions(String... pkgNames) {
final List<Tile> suggestions = new ArrayList<>();
for (String pkgName : pkgNames) {
Tile suggestion = new Tile();
suggestion.intent = new Intent("action");
suggestion.intent.setComponent(new ComponentName(pkgName, "cls"));
suggestions.add(suggestion);
suggestion.icon = mock(Icon.class);
}
return suggestions;
}
use of com.android.settingslib.drawer.Tile in project android_packages_apps_Settings by crdroidandroid.
the class AccountDetailDashboardFragmentTest method refreshDashboardTiles_NoAccountType_shouldNotDisplay.
@Test
public void refreshDashboardTiles_NoAccountType_shouldNotDisplay() {
final Tile tile = new Tile();
final Bundle metaData = new Bundle();
metaData.putString(METADATA_CATEGORY, CategoryKey.CATEGORY_ACCOUNT_DETAIL);
tile.metaData = metaData;
assertThat(mFragment.displayTile(tile)).isFalse();
}
use of com.android.settingslib.drawer.Tile in project android_packages_apps_Settings by SudaMod.
the class SiteMapManagerTest method buildBreadCrumb_fromSiteMapDbAndDashboardProvider_breadcrumbShouldLinkUp.
@Test
public void buildBreadCrumb_fromSiteMapDbAndDashboardProvider_breadcrumbShouldLinkUp() {
final String iaClass = SystemDashboardFragment.class.getName();
final String iaTitle = "ia_title";
ContentValues index = new ContentValues();
index.put(IndexDatabaseHelper.IndexColumns.CLASS_NAME, iaClass);
index.put(IndexDatabaseHelper.IndexColumns.SCREEN_TITLE, iaTitle);
mDb.replaceOrThrow(IndexDatabaseHelper.Tables.TABLE_PREFS_INDEX, null, index);
final DashboardCategory category = new DashboardCategory();
category.key = CategoryKey.CATEGORY_SYSTEM;
category.tiles.add(new Tile());
category.tiles.get(0).title = TITLE_PREFIX + STATIC_DB_DEPTH;
category.tiles.get(0).metaData = new Bundle();
category.tiles.get(0).metaData.putString(SettingsActivity.META_DATA_KEY_FRAGMENT_CLASS, CLASS_PREFIX + STATIC_DB_DEPTH);
when(mFeatureFactory.dashboardFeatureProvider.getAllCategories()).thenReturn(Arrays.asList(category));
final List<String> breadcrumb = mSiteMapManager.buildBreadCrumb(mContext, CLASS_PREFIX + 0, TITLE_PREFIX + 0);
assertThat(breadcrumb.size()).isEqualTo(STATIC_DB_DEPTH + 2);
assertThat(breadcrumb.get(0)).isEqualTo(iaTitle);
}
use of com.android.settingslib.drawer.Tile in project android_packages_apps_Settings by SudaMod.
the class DashboardAdapter method logSuggestions.
private void logSuggestions() {
final List<Tile> suggestions = mDashboardData.getSuggestions();
if (suggestions == null) {
return;
}
for (Tile suggestion : suggestions) {
final String suggestionId = mSuggestionFeatureProvider.getSuggestionIdentifier(mContext, suggestion);
if (!mSuggestionsShownLogged.contains(suggestionId)) {
mMetricsFeatureProvider.action(mContext, MetricsEvent.ACTION_SHOW_SETTINGS_SUGGESTION, suggestionId, getSuggestionTaggedData());
mSuggestionsShownLogged.add(suggestionId);
}
}
}
Aggregations