use of androidx.core.graphics.drawable.IconCompat in project android_packages_apps_Settings by omnirom.
the class SliceFullCardRendererHelperTest method buildSlice.
private Slice buildSlice() {
final String title = "test_title";
final IconCompat icon = IconCompat.createWithResource(mActivity, R.drawable.empty_icon);
final PendingIntent pendingIntent = PendingIntent.getActivity(mActivity, title.hashCode(), /* requestCode */
new Intent("test action"), PendingIntent.FLAG_IMMUTABLE);
final SliceAction action = SliceAction.createDeeplink(pendingIntent, icon, ListBuilder.SMALL_IMAGE, title);
return new ListBuilder(mActivity, TEST_SLICE_URI, ListBuilder.INFINITY).addRow(new ListBuilder.RowBuilder().addEndItem(icon, ListBuilder.ICON_IMAGE).setTitle(title).setPrimaryAction(action)).build();
}
use of androidx.core.graphics.drawable.IconCompat in project android_packages_apps_Settings by omnirom.
the class SliceHalfCardRendererHelperTest method buildSlice.
private Slice buildSlice() {
final String title = "test_title";
final IconCompat icon = IconCompat.createWithResource(mActivity, R.drawable.empty_icon);
final PendingIntent pendingIntent = PendingIntent.getActivity(mActivity, title.hashCode(), /* requestCode */
new Intent("test action"), PendingIntent.FLAG_IMMUTABLE);
final SliceAction action = SliceAction.createDeeplink(pendingIntent, icon, ListBuilder.SMALL_IMAGE, title);
return new ListBuilder(mActivity, TEST_SLICE_URI, ListBuilder.INFINITY).addRow(new ListBuilder.RowBuilder().addEndItem(icon, ListBuilder.ICON_IMAGE).setTitle(title).setPrimaryAction(action)).build();
}
use of androidx.core.graphics.drawable.IconCompat in project android_packages_apps_Settings by omnirom.
the class PanelFragmentTest method supportIcon_displayIconHeaderLayout.
@Test
public void supportIcon_displayIconHeaderLayout() {
final IconCompat icon = IconCompat.createWithResource(mContext, R.drawable.ic_android);
mFakePanelContent.setIcon(icon);
mFakePanelContent.setSubTitle(SUBTITLE);
final ActivityController<FakeSettingsPanelActivity> activityController = Robolectric.buildActivity(FakeSettingsPanelActivity.class);
activityController.setup();
final PanelFragment panelFragment = (PanelFragment) Objects.requireNonNull(activityController.get().getSupportFragmentManager().findFragmentById(R.id.main_content));
final View titleView = panelFragment.mLayoutView.findViewById(R.id.panel_title);
final LinearLayout panelHeader = panelFragment.mLayoutView.findViewById(R.id.panel_header);
final TextView headerTitle = panelFragment.mLayoutView.findViewById(R.id.header_title);
final TextView headerSubtitle = panelFragment.mLayoutView.findViewById(R.id.header_subtitle);
// Check visibility
assertThat(panelHeader.getVisibility()).isEqualTo(View.VISIBLE);
assertThat(titleView.getVisibility()).isEqualTo(View.GONE);
// Check content
assertThat(headerTitle.getText()).isEqualTo(FakePanelContent.TITLE);
assertThat(headerSubtitle.getText()).isEqualTo(SUBTITLE);
}
use of androidx.core.graphics.drawable.IconCompat in project android_packages_apps_Settings by omnirom.
the class MobileDataSliceTest method getSlice_shouldHaveTitleAndToggle.
@Test
public void getSlice_shouldHaveTitleAndToggle() {
final Slice mobileData = mMobileDataSlice.getSlice();
final SliceMetadata metadata = SliceMetadata.from(mContext, mobileData);
assertThat(metadata.getTitle()).isEqualTo(mContext.getString(R.string.mobile_data_settings_title));
final List<SliceAction> toggles = metadata.getToggles();
assertThat(toggles).hasSize(1);
final SliceAction primaryAction = metadata.getPrimaryAction();
final IconCompat expectedToggleIcon = IconCompat.createWithResource(mContext, R.drawable.ic_network_cell);
assertThat(primaryAction.getIcon().toString()).isEqualTo(expectedToggleIcon.toString());
}
use of androidx.core.graphics.drawable.IconCompat in project android_packages_apps_Settings by omnirom.
the class LocationSliceTest method getLocationSlice_correctSliceContent.
@Test
public void getLocationSlice_correctSliceContent() {
final Slice LocationSlice = new LocationSlice(mContext).getSlice();
final SliceMetadata metadata = SliceMetadata.from(mContext, LocationSlice);
assertThat(metadata.getTitle()).isEqualTo(mContext.getString(R.string.location_settings_title));
final List<SliceAction> toggles = metadata.getToggles();
assertThat(toggles).isEmpty();
final SliceAction primaryAction = metadata.getPrimaryAction();
final IconCompat expectedToggleIcon = IconCompat.createWithResource(mContext, com.android.internal.R.drawable.ic_signal_location);
assertThat(primaryAction.getIcon().toString()).isEqualTo(expectedToggleIcon.toString());
}
Aggregations