Inline slider with header

Add a header to the slider slices to allow for a second line of text.
This is important to add more context to slices outside of settings.

Bug: 80157462
Test: robotests
Change-Id: Ida90c9377afb19de320dfce54175f51eee088cfe
This commit is contained in:
Matthew Fritze
2018-05-22 06:50:49 -07:00
parent c4a3393b45
commit 647be5fc91
2 changed files with 11 additions and 5 deletions

View File

@@ -283,18 +283,21 @@ public class SliceBuilderUtils {
final PendingIntent contentIntent = getContentPendingIntent(context, sliceData);
final IconCompat icon = IconCompat.createWithResource(context, sliceData.getIconResource());
@ColorInt final int color = Utils.getColorAccentDefaultColor(context);
final CharSequence subtitleText = getSubtitleText(context, controller, sliceData);
final SliceAction primaryAction = new SliceAction(contentIntent, icon,
sliceData.getTitle());
final List<String> keywords = buildSliceKeywords(sliceData);
return new ListBuilder(context, sliceData.getUri(), ListBuilder.INFINITY)
.setAccentColor(color)
.addInputRange(builder -> builder
.setHeader(builder -> builder
.setTitle(sliceData.getTitle())
.setSubtitle(subtitleText)
.setPrimaryAction(primaryAction))
.addInputRange(builder -> builder
.setMax(sliderController.getMaxSteps())
.setValue(sliderController.getSliderPosition())
.setInputAction(actionIntent)
.setPrimaryAction(primaryAction))
.setInputAction(actionIntent))
.setKeywords(keywords)
.build();
}