use of androidx.slice.builders.SliceAction 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.slice.builders.SliceAction in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class DeviceInfoSlice method getSlice.
@Override
public Slice getSlice() {
final IconCompat icon = IconCompat.createWithResource(mContext, R.drawable.ic_info_outline_24dp);
final String title = mContext.getString(R.string.device_info_label);
final SliceAction primaryAction = SliceAction.createDeeplink(getPrimaryAction(), icon, ListBuilder.ICON_IMAGE, title);
return new ListBuilder(mContext, CustomSliceRegistry.DEVICE_INFO_SLICE_URI, ListBuilder.INFINITY).setAccentColor((Utils.getColorAccentDefaultColor(mContext))).setHeader(new ListBuilder.HeaderBuilder().setTitle(title)).addRow(new ListBuilder.RowBuilder().setTitle(getPhoneNumber()).setSubtitle(getDeviceModel()).setPrimaryAction(primaryAction)).build();
}
use of androidx.slice.builders.SliceAction in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class StorageSlice method getSlice.
@Override
public Slice getSlice() {
final IconCompat icon = IconCompat.createWithResource(mContext, R.drawable.ic_homepage_storage);
final String title = mContext.getString(R.string.storage_label);
final SliceAction primaryAction = SliceAction.createDeeplink(getPrimaryAction(), icon, ListBuilder.ICON_IMAGE, title);
final PrivateStorageInfo info = getPrivateStorageInfo();
return new ListBuilder(mContext, CustomSliceRegistry.STORAGE_SLICE_URI, ListBuilder.INFINITY).setAccentColor(Utils.getColorAccentDefaultColor(mContext)).setHeader(new ListBuilder.HeaderBuilder().setTitle(title)).addRow(new ListBuilder.RowBuilder().setTitle(getStorageUsedText(info)).setSubtitle(getStorageSummaryText(info)).setPrimaryAction(primaryAction)).build();
}
use of androidx.slice.builders.SliceAction in project Resurrection_packages_apps_Settings by ResurrectionRemix.
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"), 0);
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.slice.builders.SliceAction in project android_packages_apps_Settings by omnirom.
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.bluetooth_settings);
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