@Test public void testGetSliceActions() { Uri uri = Uri.parse("content: PendingIntent pi = getIntent(""); Bitmap b = Bitmap.createBitmap(50, 25, Bitmap.Config.ARGB_8888); new Canvas(b).drawColor(0xffff0000); IconCompat icon = IconCompat.createWithBitmap(b); SliceAction action1 = new SliceAction(pi, icon, "action1"); SliceAction action2 = new SliceAction(pi, icon, "action2"); SliceAction action3 = new SliceAction(pi, icon, "action3"); ListBuilder lb = new ListBuilder(mContext, uri, ListBuilder.INFINITY); lb.addRow(new ListBuilder.RowBuilder(lb).setTitle("Text")) .addAction(action1) .addAction(action2) .addAction(action3); ArrayList<SliceAction> expectedActions = new ArrayList<>(); expectedActions.add(action1); expectedActions.add(action2); expectedActions.add(action3); SliceMetadata sliceMetadata = SliceMetadata.from(mContext, lb.build()); List<SliceItem> actions = sliceMetadata.getSliceActions(); for (int i = 0; i < expectedActions.size(); i++) { assertEquivalent(expectedActions.get(i), new SliceActionImpl(actions.get(i))); } }
@Nullable public List<SliceItem> getSliceActions() { return mSliceActions; }
SliceMetadata { @Nullable public List<SliceItem> getSliceActions() { return mSliceActions; } }
SliceMetadata { @Nullable public List<SliceItem> getSliceActions() { return mSliceActions; } private  SliceMetadata(@NonNull Context context, @NonNull Slice slice); }
SliceMetadata { @Nullable public List<SliceItem> getSliceActions() { return mSliceActions; } 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 List<SliceItem> getSliceActions() { return mSliceActions; } 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; }