slices/view/src/main/java/androidx/slice/widget/ListContent.java
private boolean populate(Slice slice) {
        mColorItem = SliceQuery.findSubtype(slice, FORMAT_INT, SUBTYPE_COLOR);
        // Find slice actions
        mSliceActions = SliceMetadata.getSliceActions(slice);
        // Find header
        mHeaderItem = findHeaderItem(slice);
        if (mHeaderItem != null) {
            mRowItems.add(mHeaderItem);
        }
        mSeeMoreItem = getSeeMoreItem(slice);
        // Filter + create row items
        List<SliceItem> children = slice.getItems();
        for (int i = 0; i < children.size(); i++) {
            final SliceItem child = children.get(i);
            final String format = child.getFormat();
            boolean isNonRowContent = child.hasAnyHints(HINT_ACTIONS, HINT_SEE_MORE, HINT_KEYWORDS,
                    HINT_TTL, HINT_LAST_UPDATED);
            if (!isNonRowContent && (FORMAT_ACTION.equals(format) || FORMAT_SLICE.equals(format))) {
                if (mHeaderItem == null && !child.hasHint(HINT_LIST_ITEM)) {
                    mHeaderItem = child;
                    mRowItems.add(0, child);
                } else if (child.hasHint(HINT_LIST_ITEM)) {
                    mRowItems.add(child);
                }
            }
        }
        // Ensure we have something for the header -- use first row
        if (mHeaderItem == null && mRowItems.size() >= 1) {
            mHeaderItem = mRowItems.get(0);
        }
        return isValid();
    }
/**
     * @return whether this row has content that is valid to display.
     */
@return whether this row has content that is valid to display.
@return whether this row has content that is valid to display .
private boolean populate(Slice slice) {
        mColorItem = SliceQuery.findSubtype(slice, FORMAT_INT, SUBTYPE_COLOR);
        mSliceActions = SliceMetadata.getSliceActions(slice);
        mHeaderItem = findHeaderItem(slice);
        if (mHeaderItem != null) {
            mRowItems.add(mHeaderItem);
        }
        mSeeMoreItem = getSeeMoreItem(slice);
        List<SliceItem> children = slice.getItems();
        for (int i = 0; i < children.size(); i++) {
            final SliceItem child = children.get(i);
            final String format = child.getFormat();
            boolean isNonRowContent = child.hasAnyHints(HINT_ACTIONS, HINT_SEE_MORE, HINT_KEYWORDS,
                    HINT_TTL, HINT_LAST_UPDATED);
            if (!isNonRowContent && (FORMAT_ACTION.equals(format) || FORMAT_SLICE.equals(format))) {
                if (mHeaderItem == null && !child.hasHint(HINT_LIST_ITEM)) {
                    mHeaderItem = child;
                    mRowItems.add(0, child);
                } else if (child.hasHint(HINT_LIST_ITEM)) {
                    mRowItems.add(child);
                }
            }
        }
        if (mHeaderItem == null && mRowItems.size() >= 1) {
            mHeaderItem = mRowItems.get(0);
        }
        return isValid();
    }
private boolean populate ( Slice slice ) { mColorItem = SliceQuery . findSubtype ( slice , FORMAT_INT , SUBTYPE_COLOR ) ; mSliceActions = SliceMetadata . getSliceActions ( slice ) ; mHeaderItem = findHeaderItem ( slice ) ; if ( mHeaderItem != null ) { mRowItems . add ( mHeaderItem ) ; } mSeeMoreItem = getSeeMoreItem ( slice ) ; List < SliceItem > children = slice . getItems ( ) ; for ( int i = 0 ; i < children . size ( ) ; i ++ ) { final SliceItem child = children . get ( i ) ; final String format = child . getFormat ( ) ; boolean isNonRowContent = child . hasAnyHints ( HINT_ACTIONS , HINT_SEE_MORE , HINT_KEYWORDS , HINT_TTL , HINT_LAST_UPDATED ) ; if ( ! isNonRowContent && ( FORMAT_ACTION . equals ( format ) || FORMAT_SLICE . equals ( format ) ) ) { if ( mHeaderItem == null && ! child . hasHint ( HINT_LIST_ITEM ) ) { mHeaderItem = child ; mRowItems . add ( 0 , child ) ; } else if ( child . hasHint ( HINT_LIST_ITEM ) ) { mRowItems . add ( child ) ; } } } if ( mHeaderItem == null && mRowItems . size ( ) >= 1 ) { mHeaderItem = mRowItems . get ( 0 ) ; } return isValid ( ) ; }
@return whether this row has content that is valid to display.
@return whether this row has content that is valid to display .
// Find slice actions // Find header // Filter + create row items // Ensure we have something for the header -- use first row