use of androidx.core.graphics.drawable.IconCompat in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class BatteryFixSlice method buildBatteryGoodSlice.
private Slice buildBatteryGoodSlice(ListBuilder sliceBuilder, boolean isError) {
final IconCompat icon = IconCompat.createWithResource(mContext, R.drawable.ic_battery_status_good_24dp);
final String title = mContext.getString(R.string.power_usage_summary_title);
final SliceAction primaryAction = SliceAction.createDeeplink(getPrimaryAction(), icon, ListBuilder.ICON_IMAGE, title);
sliceBuilder.addRow(new RowBuilder().setTitleItem(icon, ListBuilder.ICON_IMAGE).setTitle(title).setPrimaryAction(primaryAction)).setIsError(isError);
return sliceBuilder.build();
}
use of androidx.core.graphics.drawable.IconCompat in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class SliceBuilderUtils method getCopyableAction.
private static SliceAction getCopyableAction(Context context, SliceData sliceData) {
final PendingIntent intent = getActionIntent(context, SettingsSliceProvider.ACTION_COPY, sliceData);
final IconCompat icon = IconCompat.createWithResource(context, R.drawable.ic_content_copy_grey600_24dp);
return SliceAction.create(intent, icon, ListBuilder.ICON_IMAGE, sliceData.getTitle());
}
use of androidx.core.graphics.drawable.IconCompat in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class SliceBuilderUtils method buildCopyableSlice.
private static Slice buildCopyableSlice(Context context, SliceData sliceData, BasePreferenceController controller) {
final SliceAction copyableAction = getCopyableAction(context, sliceData);
final PendingIntent contentIntent = getContentPendingIntent(context, sliceData);
final IconCompat icon = getSafeIcon(context, sliceData);
final SliceAction primaryAction = SliceAction.createDeeplink(contentIntent, icon, ListBuilder.ICON_IMAGE, sliceData.getTitle());
final CharSequence subtitleText = getSubtitleText(context, controller, sliceData);
@ColorInt final int color = Utils.getColorAccentDefaultColor(context);
final Set<String> keywords = buildSliceKeywords(sliceData);
return new ListBuilder(context, sliceData.getUri(), ListBuilder.INFINITY).setAccentColor(color).addRow(new RowBuilder().setTitle(sliceData.getTitle()).setSubtitle(subtitleText).setPrimaryAction(primaryAction).addEndItem(copyableAction)).setKeywords(keywords).build();
}
use of androidx.core.graphics.drawable.IconCompat in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class SliceBuilderUtils method buildIntentSlice.
private static Slice buildIntentSlice(Context context, SliceData sliceData, BasePreferenceController controller) {
final PendingIntent contentIntent = getContentPendingIntent(context, sliceData);
final IconCompat icon = getSafeIcon(context, sliceData);
final CharSequence subtitleText = getSubtitleText(context, controller, sliceData);
@ColorInt final int color = Utils.getColorAccentDefaultColor(context);
final Set<String> keywords = buildSliceKeywords(sliceData);
return new ListBuilder(context, sliceData.getUri(), ListBuilder.INFINITY).setAccentColor(color).addRow(new RowBuilder().setTitle(sliceData.getTitle()).setSubtitle(subtitleText).setPrimaryAction(SliceAction.createDeeplink(contentIntent, icon, ListBuilder.ICON_IMAGE, sliceData.getTitle()))).setKeywords(keywords).build();
}
use of androidx.core.graphics.drawable.IconCompat in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class BluetoothSliceBuilder method getSlice.
/**
* Return a Bluetooth Slice bound to {@link CustomSliceRegistry#BLUETOOTH_URI}.
* <p>
* Note that you should register a listener for {@link #INTENT_FILTER} to get changes for
* Bluetooth.
*/
public static Slice getSlice(Context context) {
final boolean isBluetoothEnabled = isBluetoothEnabled();
final CharSequence title = context.getText(R.string.switch_on_text);
final IconCompat icon = IconCompat.createWithResource(context, com.android.internal.R.drawable.ic_settings_bluetooth);
@ColorInt final int color = com.android.settings.Utils.getColorAccent(context).getDefaultColor();
final PendingIntent toggleAction = getBroadcastIntent(context);
final PendingIntent primaryAction = getPrimaryAction(context);
final SliceAction primarySliceAction = SliceAction.createDeeplink(primaryAction, icon, ListBuilder.ICON_IMAGE, title);
final SliceAction toggleSliceAction = SliceAction.createToggle(toggleAction, null, /* actionTitle */
isBluetoothEnabled);
return new ListBuilder(context, CustomSliceRegistry.BLUETOOTH_URI, ListBuilder.INFINITY).setAccentColor(color).addRow(new RowBuilder().setTitle(title).addEndItem(toggleSliceAction).setPrimaryAction(primarySliceAction)).build();
}
Aggregations