use of com.android.settingslib.drawer.Tile in project android_packages_apps_Settings by LineageOS.
the class DashboardFeatureProviderImplTest method bindPreference_withBaseOrder_shouldOffsetPriority.
@Test
public void bindPreference_withBaseOrder_shouldOffsetPriority() {
final int baseOrder = 100;
final Preference preference = new Preference(RuntimeEnvironment.application);
final Tile tile = new Tile();
tile.metaData = new Bundle();
tile.priority = 10;
mImpl.bindPreferenceToTile(mActivity, MetricsProto.MetricsEvent.VIEW_UNKNOWN, preference, tile, "123", baseOrder);
assertThat(preference.getOrder()).isEqualTo(-tile.priority + baseOrder);
}
use of com.android.settingslib.drawer.Tile in project android_packages_apps_Settings by LineageOS.
the class DashboardFragmentTest method tintTileIcon_noIcon_shouldReturnFalse.
@Test
public void tintTileIcon_noIcon_shouldReturnFalse() {
final Tile tile = new Tile();
final Bundle metaData = new Bundle();
tile.metaData = metaData;
assertThat(mTestFragment.tintTileIcon(tile)).isFalse();
}
use of com.android.settingslib.drawer.Tile in project android_packages_apps_Settings by LineageOS.
the class DashboardFragmentTest method tintTileIcon_hasMetadata_shouldReturnIconTintableMetadata.
@Test
public void tintTileIcon_hasMetadata_shouldReturnIconTintableMetadata() {
final Tile tile = new Tile();
tile.icon = mock(Icon.class);
final Bundle metaData = new Bundle();
tile.metaData = metaData;
metaData.putBoolean(TileUtils.META_DATA_PREFERENCE_ICON_TINTABLE, false);
assertThat(mTestFragment.tintTileIcon(tile)).isFalse();
metaData.putBoolean(TileUtils.META_DATA_PREFERENCE_ICON_TINTABLE, true);
assertThat(mTestFragment.tintTileIcon(tile)).isTrue();
}
use of com.android.settingslib.drawer.Tile in project android_packages_apps_Settings by LineageOS.
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 LineageOS.
the class SummaryLoaderTest method SetUp.
@Before
public void SetUp() {
MockitoAnnotations.initMocks(this);
mFeatureFactory = FakeFeatureFactory.setupForTest(mContext);
mTile = new Tile();
mTile.summary = SUMMARY_1;
mCallbackInvoked = false;
final Activity activity = Robolectric.buildActivity(Activity.class).get();
final List<DashboardCategory> categories = new ArrayList<>();
mSummaryLoader = new SummaryLoader(activity, categories);
mSummaryLoader.setSummaryConsumer(new SummaryLoader.SummaryConsumer() {
@Override
public void notifySummaryChanged(Tile tile) {
mCallbackInvoked = true;
}
});
}
Aggregations