Search in sources :

Example 6 with HeaderItem

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

the class TVSearchFragment method createLoadingRow.

private ListRow createLoadingRow() {
    final HeaderItem loadingHeader = new HeaderItem(getString(R.string.search_results));
    ClassPresenterSelector presenterSelector = new ClassPresenterSelector();
    presenterSelector.addClassPresenter(MediaCardItem.class, new MediaCardPresenter(getActivity(), picasso));
    presenterSelector.addClassPresenter(LoadingCardItem.class, new LoadingCardPresenter(getActivity()));
    ArrayObjectAdapter loadingRowAdapter = new ArrayObjectAdapter(presenterSelector);
    loadingRowAdapter.add(new LoadingCardItem());
    return new ListRow(loadingHeader, loadingRowAdapter);
}
Also used : LoadingCardPresenter(butter.droid.tv.presenters.LoadingCardPresenter) HeaderItem(android.support.v17.leanback.widget.HeaderItem) ArrayObjectAdapter(android.support.v17.leanback.widget.ArrayObjectAdapter) LoadingCardItem(butter.droid.tv.presenters.LoadingCardPresenter.LoadingCardItem) ClassPresenterSelector(android.support.v17.leanback.widget.ClassPresenterSelector) MediaCardPresenter(butter.droid.tv.presenters.MediaCardPresenter) ListRow(android.support.v17.leanback.widget.ListRow)

Example 7 with HeaderItem

use of android.support.v17.leanback.widget.HeaderItem 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 8 with HeaderItem

use of android.support.v17.leanback.widget.HeaderItem 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 9 with HeaderItem

use of android.support.v17.leanback.widget.HeaderItem 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 10 with HeaderItem

use of android.support.v17.leanback.widget.HeaderItem 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)

Aggregations

HeaderItem (android.support.v17.leanback.widget.HeaderItem)17 ArrayObjectAdapter (android.support.v17.leanback.widget.ArrayObjectAdapter)16 ListRow (android.support.v17.leanback.widget.ListRow)14 ListRowPresenter (android.support.v17.leanback.widget.ListRowPresenter)4 CardPresenterSelector (cx.ring.tv.cards.CardPresenterSelector)4 ContactCard (cx.ring.tv.cards.contacts.ContactCard)4 MediaCardPresenter (butter.droid.tv.presenters.MediaCardPresenter)3 Card (cx.ring.tv.cards.Card)3 CardListRow (cx.ring.tv.cards.CardListRow)3 CardRow (cx.ring.tv.cards.CardRow)3 ContactRequestCard (cx.ring.tv.cards.contactrequests.ContactRequestCard)3 IconCard (cx.ring.tv.cards.iconcards.IconCard)3 VCard (ezvcard.VCard)3 ClassPresenterSelector (android.support.v17.leanback.widget.ClassPresenterSelector)2 LoadingCardPresenter (butter.droid.tv.presenters.LoadingCardPresenter)2 LoadingCardItem (butter.droid.tv.presenters.LoadingCardPresenter.LoadingCardItem)2 MorePresenter (butter.droid.tv.presenters.MorePresenter)2 ShadowRowPresenterSelector (cx.ring.tv.cards.ShadowRowPresenterSelector)2 ArrayList (java.util.ArrayList)2 SearchAggregate (org.videolan.medialibrary.media.SearchAggregate)2