Search in sources :

Example 11 with ArrayObjectAdapter

use of android.support.v17.leanback.widget.ArrayObjectAdapter in project butter-android by butterproject.

the class TVSearchFragment method replaceRow.

@Override
public void replaceRow(int index, @StringRes int title, List<MediaCardItem> items) {
    rowsAdapter.remove(loadingRow);
    HeaderItem header = new HeaderItem(getString(title));
    ArrayObjectAdapter listRowAdapter = new ArrayObjectAdapter(new MediaCardPresenter(getActivity(), picasso));
    listRowAdapter.addAll(0, items);
    ListRow row = new ListRow(header, listRowAdapter);
    if (rowsAdapter.size() > index) {
        rowsAdapter.replace(index, row);
    } else {
        rowsAdapter.add(index, row);
    }
}
Also used : HeaderItem(android.support.v17.leanback.widget.HeaderItem) ArrayObjectAdapter(android.support.v17.leanback.widget.ArrayObjectAdapter) MediaCardPresenter(butter.droid.tv.presenters.MediaCardPresenter) ListRow(android.support.v17.leanback.widget.ListRow)

Example 12 with ArrayObjectAdapter

use of android.support.v17.leanback.widget.ArrayObjectAdapter in project butter-android by butterproject.

the class TVOverviewFragment method setupMoreRow.

@Override
public void setupMoreRow() {
    HeaderItem gridHeader = new HeaderItem(getString(R.string.more));
    MorePresenter gridPresenter = new MorePresenter(requireContext());
    ArrayObjectAdapter gridRowAdapter = new ArrayObjectAdapter(gridPresenter);
    gridRowAdapter.add(new MorePresenter.MoreItem(R.id.more_item_settings, R.string.preferences, R.drawable.ic_settings));
    rowsAdapter.add(new ListRow(gridHeader, gridRowAdapter));
}
Also used : HeaderItem(android.support.v17.leanback.widget.HeaderItem) ArrayObjectAdapter(android.support.v17.leanback.widget.ArrayObjectAdapter) MorePresenter(butter.droid.tv.presenters.MorePresenter) ListRow(android.support.v17.leanback.widget.ListRow)

Example 13 with ArrayObjectAdapter

use of android.support.v17.leanback.widget.ArrayObjectAdapter in project ring-client-android by savoirfairelinux.

the class MainFragment method createRow.

private Row createRow(String titleSection, List<Card> cards, boolean shadow) {
    CardRow row = new CardRow(CardRow.TYPE_DEFAULT, shadow, titleSection, cards);
    PresenterSelector presenterSelector = new CardPresenterSelector(getActivity());
    ArrayObjectAdapter listRowAdapter = new ArrayObjectAdapter(presenterSelector);
    for (Card card : cards) {
        listRowAdapter.add(card);
    }
    return new CardListRow(new HeaderItem(HEADER_MISC, titleSection), listRowAdapter, row);
}
Also used : CardPresenterSelector(cx.ring.tv.cards.CardPresenterSelector) ShadowRowPresenterSelector(cx.ring.tv.cards.ShadowRowPresenterSelector) PresenterSelector(android.support.v17.leanback.widget.PresenterSelector) CardListRow(cx.ring.tv.cards.CardListRow) CardRow(cx.ring.tv.cards.CardRow) CardPresenterSelector(cx.ring.tv.cards.CardPresenterSelector) ArrayObjectAdapter(android.support.v17.leanback.widget.ArrayObjectAdapter) HeaderItem(android.support.v17.leanback.widget.HeaderItem) VCard(ezvcard.VCard) IconCard(cx.ring.tv.cards.iconcards.IconCard) ContactRequestCard(cx.ring.tv.cards.contactrequests.ContactRequestCard) ContactCard(cx.ring.tv.cards.contacts.ContactCard) Card(cx.ring.tv.cards.Card)

Example 14 with ArrayObjectAdapter

use of android.support.v17.leanback.widget.ArrayObjectAdapter in project ring-client-android by savoirfairelinux.

the class RingSearchFragment method displayContact.

@Override
public void displayContact(final CallContact contact) {
    getActivity().runOnUiThread(() -> {
        mRowsAdapter.clear();
        ArrayObjectAdapter listRowAdapter = new ArrayObjectAdapter(new CardPresenterSelector(getActivity()));
        listRowAdapter.add(new ContactCard(contact, Card.Type.SEARCH_RESULT));
        HeaderItem header = new HeaderItem(getActivity().getResources().getString(R.string.search_results));
        mRowsAdapter.add(new ListRow(header, listRowAdapter));
    });
}
Also used : ContactCard(cx.ring.tv.cards.contacts.ContactCard) CardPresenterSelector(cx.ring.tv.cards.CardPresenterSelector) ArrayObjectAdapter(android.support.v17.leanback.widget.ArrayObjectAdapter) HeaderItem(android.support.v17.leanback.widget.HeaderItem) ListRow(android.support.v17.leanback.widget.ListRow)

Example 15 with ArrayObjectAdapter

use of android.support.v17.leanback.widget.ArrayObjectAdapter in project cw-omnibus by commonsguy.

the class VideosFragment method onLoadFinished.

@Override
public void onLoadFinished(Loader<Cursor> loader, Cursor c) {
    mapCursorToModels(c);
    setHeadersState(BrowseFragment.HEADERS_ENABLED);
    setTitle(getString(R.string.app_name));
    ArrayObjectAdapter rows = new ArrayObjectAdapter(new ListRowPresenter());
    ArrayObjectAdapter listRowAdapter = new ArrayObjectAdapter(new VideoPresenter(getActivity()));
    for (Video v : videos) {
        listRowAdapter.add(v);
    }
    HeaderItem header = new HeaderItem(0, "Videos", null);
    rows.add(new ListRow(header, listRowAdapter));
    setAdapter(rows);
}
Also used : ListRowPresenter(android.support.v17.leanback.widget.ListRowPresenter) ArrayObjectAdapter(android.support.v17.leanback.widget.ArrayObjectAdapter) HeaderItem(android.support.v17.leanback.widget.HeaderItem) ListRow(android.support.v17.leanback.widget.ListRow)

Aggregations

ArrayObjectAdapter (android.support.v17.leanback.widget.ArrayObjectAdapter)33 HeaderItem (android.support.v17.leanback.widget.HeaderItem)16 ListRow (android.support.v17.leanback.widget.ListRow)13 ListRowPresenter (android.support.v17.leanback.widget.ListRowPresenter)13 ClassPresenterSelector (android.support.v17.leanback.widget.ClassPresenterSelector)8 Intent (android.content.Intent)5 DetailsOverviewRow (android.support.v17.leanback.widget.DetailsOverviewRow)4 FullWidthDetailsOverviewRowPresenter (android.support.v17.leanback.widget.FullWidthDetailsOverviewRowPresenter)4 Card (cx.ring.tv.cards.Card)4 CardPresenterSelector (cx.ring.tv.cards.CardPresenterSelector)4 ContactCard (cx.ring.tv.cards.contacts.ContactCard)4 IconCard (cx.ring.tv.cards.iconcards.IconCard)4 Activity (android.app.Activity)3 Bundle (android.os.Bundle)3 OnItemViewClickedListener (android.support.v17.leanback.widget.OnItemViewClickedListener)3 VerticalGridPresenter (android.support.v17.leanback.widget.VerticalGridPresenter)3 MediaCardPresenter (butter.droid.tv.presenters.MediaCardPresenter)3 CardListRow (cx.ring.tv.cards.CardListRow)3 CardRow (cx.ring.tv.cards.CardRow)3 ContactRequestCard (cx.ring.tv.cards.contactrequests.ContactRequestCard)3