use of androidx.slice.builders.ListBuilder 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.ListBuilder 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.ListBuilder in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class WifiCallingSliceHelper method getWifiCallingPreferenceSlice.
/**
* Returns actionable wifi calling preference slice.
*
* @param isWifiOnlySupported adds row for wifi only if this is true
* @param currentWfcPref current Preference {@link ImsConfig}
* @param sliceUri sliceUri
* @return Slice for actionable wifi calling preference settings
*/
private Slice getWifiCallingPreferenceSlice(boolean isWifiOnlySupported, int currentWfcPref, Uri sliceUri) {
final IconCompat icon = IconCompat.createWithResource(mContext, R.drawable.wifi_signal);
// Top row shows information on current preference state
ListBuilder listBuilder = new ListBuilder(mContext, sliceUri, ListBuilder.INFINITY).setAccentColor(Utils.getColorAccentDefaultColor(mContext));
listBuilder.setHeader(new ListBuilder.HeaderBuilder().setTitle(mContext.getText(R.string.wifi_calling_mode_title)).setSubtitle(getWifiCallingPreferenceSummary(currentWfcPref)).setPrimaryAction(SliceAction.createDeeplink(getActivityIntent(ACTION_WIFI_CALLING_SETTINGS_ACTIVITY), icon, ListBuilder.ICON_IMAGE, mContext.getText(R.string.wifi_calling_mode_title))));
if (isWifiOnlySupported) {
listBuilder.addRow(wifiPreferenceRowBuilder(listBuilder, com.android.internal.R.string.wfc_mode_wifi_only_summary, ACTION_WIFI_CALLING_PREFERENCE_WIFI_ONLY, currentWfcPref == ImsConfig.WfcModeFeatureValueConstants.WIFI_ONLY));
}
listBuilder.addRow(wifiPreferenceRowBuilder(listBuilder, com.android.internal.R.string.wfc_mode_wifi_preferred_summary, ACTION_WIFI_CALLING_PREFERENCE_WIFI_PREFERRED, currentWfcPref == ImsConfig.WfcModeFeatureValueConstants.WIFI_PREFERRED));
listBuilder.addRow(wifiPreferenceRowBuilder(listBuilder, com.android.internal.R.string.wfc_mode_cellular_preferred_summary, ACTION_WIFI_CALLING_PREFERENCE_CELLULAR_PREFERRED, currentWfcPref == ImsConfig.WfcModeFeatureValueConstants.CELLULAR_PREFERRED));
return listBuilder.build();
}
use of androidx.slice.builders.ListBuilder 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.ListBuilder 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