use of androidx.core.graphics.drawable.IconCompat in project android_packages_apps_Settings by omnirom.
the class LocationSlice method getSlice.
@Override
public Slice getSlice() {
final IconCompat icon = IconCompat.createWithResource(mContext, com.android.internal.R.drawable.ic_signal_location);
final CharSequence title = mContext.getText(R.string.location_settings_title);
@ColorInt final int color = Utils.getColorAccentDefaultColor(mContext);
final PendingIntent primaryAction = getPrimaryAction();
final SliceAction primarySliceAction = SliceAction.createDeeplink(primaryAction, icon, ListBuilder.ICON_IMAGE, title);
return new ListBuilder(mContext, CustomSliceRegistry.LOCATION_SLICE_URI, ListBuilder.INFINITY).setAccentColor(color).addRow(new RowBuilder().setTitle(title).setTitleItem(icon, ICON_IMAGE).setPrimaryAction(primarySliceAction)).build();
}
use of androidx.core.graphics.drawable.IconCompat in project android_packages_apps_Settings by omnirom.
the class UtilsTest method createIconWithDrawable_VectorDrawable.
@Test
public void createIconWithDrawable_VectorDrawable() {
final VectorDrawable drawable = VectorDrawable.create(mContext.getResources(), R.drawable.ic_settings_accent);
final IconCompat icon = Utils.createIconWithDrawable(drawable);
assertThat(icon.getBitmap()).isNotNull();
}
use of androidx.core.graphics.drawable.IconCompat in project android_packages_apps_Settings by omnirom.
the class UtilsTest method createIconWithDrawable_ColorDrawable.
@Test
public void createIconWithDrawable_ColorDrawable() {
final ColorDrawable drawable = new ColorDrawable(Color.BLACK);
final IconCompat icon = Utils.createIconWithDrawable(drawable);
assertThat(icon.getBitmap()).isNotNull();
}
use of androidx.core.graphics.drawable.IconCompat in project android_packages_apps_Settings by omnirom.
the class WifiSlice method getHeaderRow.
protected ListBuilder.RowBuilder getHeaderRow(boolean isWifiEnabled, WifiSliceItem wifiSliceItem) {
final IconCompat icon = IconCompat.createWithResource(mContext, R.drawable.ic_settings_wireless);
final String title = mContext.getString(R.string.wifi_settings);
final PendingIntent primaryAction = getPrimaryAction();
final SliceAction primarySliceAction = SliceAction.createDeeplink(primaryAction, icon, ListBuilder.ICON_IMAGE, title);
return new ListBuilder.RowBuilder().setTitle(title).setPrimaryAction(primarySliceAction);
}
use of androidx.core.graphics.drawable.IconCompat in project android_packages_apps_Settings by omnirom.
the class WifiSlice method getWifiSliceItemRow.
protected ListBuilder.RowBuilder getWifiSliceItemRow(WifiSliceItem wifiSliceItem) {
final CharSequence title = wifiSliceItem.getTitle();
final IconCompat levelIcon = getWifiSliceItemLevelIcon(wifiSliceItem);
final ListBuilder.RowBuilder rowBuilder = new ListBuilder.RowBuilder().setTitleItem(levelIcon, ListBuilder.ICON_IMAGE).setTitle(title).setSubtitle(wifiSliceItem.getSummary()).setContentDescription(wifiSliceItem.getContentDescription()).setPrimaryAction(getWifiEntryAction(wifiSliceItem, levelIcon, title));
final IconCompat endIcon = getEndIcon(wifiSliceItem);
if (endIcon != null) {
rowBuilder.addEndItem(endIcon, ListBuilder.ICON_IMAGE);
}
return rowBuilder;
}
Aggregations