Java 类android.support.v17.leanback.widget.SectionRow 实例源码

项目:chaosflix    文件:ConferencesBrowseFragment.java   
private void addStreams(CardPresenter cardPresenter, List<LiveConference> liveConferences) {
        if (liveConferences.size() > 0) {
            HeaderItem streamingHeader = new HeaderItem(getString(R.string.livestreams));
            mStreamingSection = new SectionRow(streamingHeader);
            mRowsAdapter.add(0, mStreamingSection);
            for (LiveConference con : liveConferences) {
                if(!con.getConference().equals("Sendeschleife")){
                    int i = -1;
                    for (i = 0; i < con.getGroups().size(); i++) {
                        Group g = con.getGroups().get(i);
                        // setup header
                        String group = g.getGroup().length() > 0 ? g.getGroup() : con.getConference();
                        HeaderItem header = new HeaderItem(group);
                        header.setDescription(con.getConference() + " - " + con.getDescription());
                        header.setContentDescription(group);
                        // setup list
                        ArrayObjectAdapter listRowAdapter
                                = new ArrayObjectAdapter(cardPresenter);
                        listRowAdapter.addAll(listRowAdapter.size(), g.getRooms());
                        mRowsAdapter.add(i + 1, new ListRow(header, listRowAdapter));
                    }
                }
//              mRowsAdapter.add(i + 1, new DividerRow());
            }
        }
    }
项目:leanback-showcase    文件:CardExampleFragment.java   
private Row createCardRow(final CardRow cardRow) {
    switch (cardRow.getType()) {
        case CardRow.TYPE_SECTION_HEADER:
            return new SectionRow(new HeaderItem(cardRow.getTitle()));
        case CardRow.TYPE_DIVIDER:
            return new DividerRow();
        case CardRow.TYPE_DEFAULT:
        default:
            // Build main row using the ImageCardViewPresenter.
            PresenterSelector presenterSelector = new CardPresenterSelector(getActivity());
            ArrayObjectAdapter listRowAdapter = new ArrayObjectAdapter(presenterSelector);
            for (Card card : cardRow.getCards()) {
                listRowAdapter.add(card);
            }
            return new CardListRow(new HeaderItem(cardRow.getTitle()), listRowAdapter, cardRow);
    }
}
项目:chaosflix-leanback    文件:ConferencesBrowseFragment.java   
private void addStreams(CardPresenter cardPresenter, List<LiveConference> liveConferences) {
        if (liveConferences.size() > 0) {
            HeaderItem streamingHeader = new HeaderItem(getString(R.string.livestreams));
            mStreamingSection = new SectionRow(streamingHeader);
            mRowsAdapter.add(0, mStreamingSection);
            for (LiveConference con : liveConferences) {
                if(!con.getConference().equals("Sendeschleife") || BuildConfig.DEBUG){
                    int i = -1;
                    for (i = 0; i < con.getGroups().size(); i++) {
                        Group g = con.getGroups().get(i);
                        // setup header
                        String group = g.getGroup().length() > 0 ? g.getGroup() : con.getConference();
                        HeaderItem header = new HeaderItem(group);
                        header.setDescription(con.getConference() + " - " + con.getDescription());
                        header.setContentDescription(group);
                        // setup list
                        ArrayObjectAdapter listRowAdapter
                                = new ArrayObjectAdapter(cardPresenter);
                        listRowAdapter.addAll(listRowAdapter.size(), g.getRooms());
                        mRowsAdapter.add(i + 1, new ListRow(header, listRowAdapter));
                    }
                }
//              mRowsAdapter.add(i + 1, new DividerRow());

            }
        }
    }