use of androidx.core.graphics.drawable.IconCompat in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class MediaOutputSlice method getActiveDeviceHeaderRow.
private ListBuilder.RowBuilder getActiveDeviceHeaderRow(MediaDevice device) {
final String title = device.getName();
final IconCompat icon = getDeviceIconCompat(device);
final PendingIntent broadcastAction = getBroadcastIntent(mContext, device.getId(), device.hashCode());
final SliceAction primarySliceAction = SliceAction.createDeeplink(broadcastAction, icon, ListBuilder.ICON_IMAGE, title);
final ListBuilder.RowBuilder rowBuilder = new ListBuilder.RowBuilder().setTitleItem(icon, ListBuilder.ICON_IMAGE).setTitle(title).setSubtitle(device.getSummary()).setPrimaryAction(primarySliceAction);
return rowBuilder;
}
use of androidx.core.graphics.drawable.IconCompat in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class ContextualWifiSliceTest method getWifiSlice_previousDisplayed_hasActiveConnection_shouldHaveTitleAndToggle.
@Test
public void getWifiSlice_previousDisplayed_hasActiveConnection_shouldHaveTitleAndToggle() {
mWifiSlice.sActiveUiSession = mFeatureFactory.slicesFeatureProvider.getUiSessionToken();
mWifiSlice.sPreviouslyDisplayed = true;
connectToWifi(makeValidatedNetworkCapabilities());
final Slice wifiSlice = mWifiSlice.getSlice();
final SliceMetadata metadata = SliceMetadata.from(mContext, wifiSlice);
assertThat(metadata.getTitle()).isEqualTo(mContext.getString(R.string.wifi_settings));
final List<SliceAction> toggles = metadata.getToggles();
assertThat(toggles).hasSize(1);
final SliceAction primaryAction = metadata.getPrimaryAction();
final IconCompat expectedToggleIcon = IconCompat.createWithResource(mContext, R.drawable.ic_settings_wireless);
assertThat(primaryAction.getIcon().toString()).isEqualTo(expectedToggleIcon.toString());
}
use of androidx.core.graphics.drawable.IconCompat in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class ContextualWifiSliceTest method getWifiSlice_isCaptivePortal_shouldHaveTitleAndToggle.
@Test
public void getWifiSlice_isCaptivePortal_shouldHaveTitleAndToggle() {
mWifiSlice.sPreviouslyDisplayed = false;
connectToWifi(WifiSliceTest.makeCaptivePortalNetworkCapabilities());
final Slice wifiSlice = mWifiSlice.getSlice();
final SliceMetadata metadata = SliceMetadata.from(mContext, wifiSlice);
assertThat(metadata.getTitle()).isEqualTo(mContext.getString(R.string.wifi_settings));
final List<SliceAction> toggles = metadata.getToggles();
assertThat(toggles).hasSize(1);
final SliceAction primaryAction = metadata.getPrimaryAction();
final IconCompat expectedToggleIcon = IconCompat.createWithResource(mContext, R.drawable.ic_settings_wireless);
assertThat(primaryAction.getIcon().toString()).isEqualTo(expectedToggleIcon.toString());
}
use of androidx.core.graphics.drawable.IconCompat in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class WifiSliceTest method getWifiSlice_isCaptivePortal_shouldHaveCaptivePortalItems.
@Test
public void getWifiSlice_isCaptivePortal_shouldHaveCaptivePortalItems() {
setWorkerResults(createAccessPoint(AP1_NAME, true, true));
doReturn(makeCaptivePortalNetworkCapabilities()).when(mConnectivityManager).getNetworkCapabilities(any());
final IconCompat expectedIcon = IconCompat.createWithResource(mContext, R.drawable.ic_settings_accent);
final Slice wifiSlice = mWifiSlice.getSlice();
final List<SliceItem> sliceItems = wifiSlice.getItems();
SliceTester.assertAnySliceItemContainsTitle(sliceItems, AP1_NAME);
SliceTester.assertAnySliceItemContainsIcon(sliceItems, expectedIcon);
}
use of androidx.core.graphics.drawable.IconCompat in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class WifiSliceTest method getWifiSlice_shouldHaveTitleAndToggle.
@Test
public void getWifiSlice_shouldHaveTitleAndToggle() {
final Slice wifiSlice = mWifiSlice.getSlice();
final SliceMetadata metadata = SliceMetadata.from(mContext, wifiSlice);
assertThat(metadata.getTitle()).isEqualTo(mContext.getString(R.string.wifi_settings));
final List<SliceAction> toggles = metadata.getToggles();
assertThat(toggles).hasSize(1);
final SliceAction primaryAction = metadata.getPrimaryAction();
final IconCompat expectedToggleIcon = IconCompat.createWithResource(mContext, R.drawable.ic_settings_wireless);
assertThat(primaryAction.getIcon().toString()).isEqualTo(expectedToggleIcon.toString());
}
Aggregations