@Test public void testGetInputRangeAction() { Uri uri = Uri.parse("content: PendingIntent expectedIntent = getIntent("rangeintent"); Bitmap b = Bitmap.createBitmap(50, 25, Bitmap.Config.ARGB_8888); new Canvas(b).drawColor(0xffff0000); IconCompat icon = IconCompat.createWithBitmap(b); SliceAction primaryAction = new SliceAction(getIntent(""), icon, "action"); ListBuilder lb = new ListBuilder(mContext, uri, ListBuilder.INFINITY); lb.addInputRange(new ListBuilder.InputRangeBuilder(lb) .setTitle("another title") .setValue(7) .setMin(5) .setMax(10) .setPrimaryAction(primaryAction) .setInputAction(expectedIntent)); Slice sliderSlice = lb.build(); SliceMetadata sliderInfo = SliceMetadata.from(mContext, sliderSlice); assertEquals(expectedIntent, sliderInfo.getInputRangeAction()); assertEquivalent(primaryAction, sliderInfo.getPrimaryAction()); }
@Nullable public PendingIntent getInputRangeAction() { if (mTemplateType == ROW_TYPE_SLIDER) { RowContent rc = new RowContent(mContext, mHeaderItem, true ); SliceItem range = rc.getRange(); if (range != null) { return range.getAction(); } } return null; }
SliceMetadata { @Nullable public PendingIntent getInputRangeAction() { if (mTemplateType == ROW_TYPE_SLIDER) { RowContent rc = new RowContent(mContext, mHeaderItem, true ); SliceItem range = rc.getRange(); if (range != null) { return range.getAction(); } } return null; } }
SliceMetadata { @Nullable public PendingIntent getInputRangeAction() { if (mTemplateType == ROW_TYPE_SLIDER) { RowContent rc = new RowContent(mContext, mHeaderItem, true ); SliceItem range = rc.getRange(); if (range != null) { return range.getAction(); } } return null; } private  SliceMetadata(@NonNull Context context, @NonNull Slice slice); }
SliceMetadata { @Nullable public PendingIntent getInputRangeAction() { if (mTemplateType == ROW_TYPE_SLIDER) { RowContent rc = new RowContent(mContext, mHeaderItem, true ); SliceItem range = rc.getRange(); if (range != null) { return range.getAction(); } } return null; } private  SliceMetadata(@NonNull Context context, @NonNull Slice slice); static SliceMetadata from(@NonNull Context context, @NonNull Slice slice); @Nullable List<SliceItem> getSliceActions(); @Nullable SliceAction getPrimaryAction(); @EventInfo.SliceRowType int getHeaderType(); boolean hasLargeMode(); List<SliceAction> getToggles(); @Nullable PendingIntent getInputRangeAction(); @Nullable Pair<Integer, Integer> getRange(); @NonNull int getRangeValue(); @Nullable List<String> getSliceKeywords(); int getLoadingState(); long getExpiry(); long getLastUpdatedTime(); boolean isPermissionSlice(); @Nullable @RestrictTo(RestrictTo.Scope.LIBRARY) static List<SliceItem> getSliceActions(@NonNull Slice slice); }
SliceMetadata { @Nullable public PendingIntent getInputRangeAction() { if (mTemplateType == ROW_TYPE_SLIDER) { RowContent rc = new RowContent(mContext, mHeaderItem, true ); SliceItem range = rc.getRange(); if (range != null) { return range.getAction(); } } return null; } private  SliceMetadata(@NonNull Context context, @NonNull Slice slice); static SliceMetadata from(@NonNull Context context, @NonNull Slice slice); @Nullable List<SliceItem> getSliceActions(); @Nullable SliceAction getPrimaryAction(); @EventInfo.SliceRowType int getHeaderType(); boolean hasLargeMode(); List<SliceAction> getToggles(); @Nullable PendingIntent getInputRangeAction(); @Nullable Pair<Integer, Integer> getRange(); @NonNull int getRangeValue(); @Nullable List<String> getSliceKeywords(); int getLoadingState(); long getExpiry(); long getLastUpdatedTime(); boolean isPermissionSlice(); @Nullable @RestrictTo(RestrictTo.Scope.LIBRARY) static List<SliceItem> getSliceActions(@NonNull Slice slice); static final int LOADED_NONE; static final int LOADED_PARTIAL; static final int LOADED_ALL; }