use of com.android.settingslib.drawer.Tile in project android_packages_apps_Settings by omnirom.
the class DashboardAdapterTest method testSetCategoriesAndSuggestions_iconTinted.
@Test
public void testSetCategoriesAndSuggestions_iconTinted() {
TypedArray mockTypedArray = mock(TypedArray.class);
doReturn(mockTypedArray).when(mContext).obtainStyledAttributes(any(int[].class));
doReturn(0x89000000).when(mockTypedArray).getColor(anyInt(), anyInt());
List<Tile> packages = makeSuggestions("pkg1");
Icon mockIcon = mock(Icon.class);
packages.get(0).isIconTintable = true;
packages.get(0).icon = mockIcon;
mDashboardAdapter.setCategoriesAndSuggestions(null, /* category */
packages);
verify(mockIcon).setTint(eq(0x89000000));
}
use of com.android.settingslib.drawer.Tile in project android_packages_apps_Settings by omnirom.
the class DashboardDataTest method testGetPositionByTile_equalTitle_returnPositionFound.
@Test
public void testGetPositionByTile_equalTitle_returnPositionFound() {
final Tile tile = mock(Tile.class);
tile.title = TEST_CATEGORY_TILE_TITLE;
final int position = mDashboardDataWithOneConditions.getPositionByTile(tile);
assertThat(position).isNotEqualTo(DashboardData.POSITION_NOT_FOUND);
}
use of com.android.settingslib.drawer.Tile in project android_packages_apps_Settings by omnirom.
the class DashboardDataTest method testDiffUtil_typeSuggestedContainer_ResultDataNothingChanged.
@Test
public void testDiffUtil_typeSuggestedContainer_ResultDataNothingChanged() {
// Build testResultData
final List<ListUpdateResult.ResultData> testResultData = new ArrayList<>();
testResultData.add(new ListUpdateResult.ResultData(ListUpdateResult.ResultData.TYPE_OPERATION_CHANGE, 0, 1));
Tile tile = new Tile();
tile.remoteViews = mock(RemoteViews.class);
DashboardData prevData = new DashboardData.Builder().setConditions(null).setCategory(null).setSuggestions(Arrays.asList(tile)).build();
DashboardData currentData = new DashboardData.Builder().setConditions(null).setCategory(null).setSuggestions(Arrays.asList(tile)).build();
testDiffUtil(prevData, currentData, testResultData);
}
use of com.android.settingslib.drawer.Tile in project android_packages_apps_Settings by omnirom.
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 omnirom.
the class SecurityFeatureProviderImplTest method updateTilesData_shouldNotProcessNonMatchingPreference.
@Test
public void updateTilesData_shouldNotProcessNonMatchingPreference() {
DashboardCategory dashboardCategory = new DashboardCategory();
dashboardCategory.addTile(new Tile());
mImpl.updatePreferencesToRunOnWorkerThread(mContext, getPreferenceScreen(), dashboardCategory);
ShadowLooper.runUiThreadTasks();
verifyNoMoreInteractions(mPackageManager);
}
Aggregations