Search in sources :

Example 26 with ArrayObjectAdapter

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

the class TVOverviewFragment method setupAdapters.

private void setupAdapters() {
    // setup main adapter
    ListRowPresenter mainMenuRowPresenter = new ListRowPresenter();
    mainMenuRowPresenter.setShadowEnabled(false);
    rowsAdapter = new ArrayObjectAdapter(mainMenuRowPresenter);
    setAdapter(rowsAdapter);
}
Also used : ListRowPresenter(android.support.v17.leanback.widget.ListRowPresenter) ArrayObjectAdapter(android.support.v17.leanback.widget.ArrayObjectAdapter)

Example 27 with ArrayObjectAdapter

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

the class TVOverviewFragment method addNewMediaListAdapter.

private ArrayObjectAdapter addNewMediaListAdapter() {
    Context context = requireContext();
    ClassPresenterSelector presenterSelector = new ClassPresenterSelector();
    presenterSelector.addClassPresenter(MediaCardItem.class, new MediaCardPresenter(context, picasso));
    presenterSelector.addClassPresenter(LoadingCardItem.class, new LoadingCardPresenter(context));
    ArrayObjectAdapter mediaAdapter = new ArrayObjectAdapter(presenterSelector);
    mediaAdapter.add(new LoadingCardItem());
    // TODO: 6/17/17 Define title
    HeaderItem moviesHeader = new HeaderItem(getString(R.string.top_movies));
    rowsAdapter.add(new ListRow(moviesHeader, mediaAdapter));
    return mediaAdapter;
}
Also used : Context(android.content.Context) LoadingCardPresenter(butter.droid.tv.presenters.LoadingCardPresenter) ArrayObjectAdapter(android.support.v17.leanback.widget.ArrayObjectAdapter) LoadingCardItem(butter.droid.tv.presenters.LoadingCardPresenter.LoadingCardItem) HeaderItem(android.support.v17.leanback.widget.HeaderItem) ClassPresenterSelector(android.support.v17.leanback.widget.ClassPresenterSelector) MediaCardPresenter(butter.droid.tv.presenters.MediaCardPresenter) ListRow(android.support.v17.leanback.widget.ListRow)

Example 28 with ArrayObjectAdapter

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

the class TVOverviewFragment method displayProviderData.

@Override
public void displayProviderData(final int providerId, final List<MediaCardItem> list) {
    ArrayObjectAdapter adapter = mediaListAdapters[providerId];
    adapter.clear();
    adapter.addAll(0, list);
}
Also used : ArrayObjectAdapter(android.support.v17.leanback.widget.ArrayObjectAdapter)

Example 29 with ArrayObjectAdapter

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

the class TVBaseDetailsFragment method initData.

@Override
public void initData(final MediaWrapper item) {
    presenterSelector = new ClassPresenterSelector();
    populatePresenterSelector(presenterSelector);
    adapter = new ArrayObjectAdapter(presenterSelector);
    setupDetailsOverviewRowPresenter(item);
    detailsRow = new DetailsOverviewRow(item);
    adapter.add(detailsRow);
    setAdapter(adapter);
}
Also used : ArrayObjectAdapter(android.support.v17.leanback.widget.ArrayObjectAdapter) ClassPresenterSelector(android.support.v17.leanback.widget.ClassPresenterSelector) DetailsOverviewRow(android.support.v17.leanback.widget.DetailsOverviewRow)

Example 30 with ArrayObjectAdapter

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

the class TVShowDetailsFragment method showSeasons.

@Override
public void showSeasons(final Season[] seasons) {
    ArrayObjectAdapter objectAdapter = getObjectArrayAdapter();
    for (int i = 0; i < seasons.length; i++) {
        Season season = seasons[i];
        HeaderItem header = new HeaderItem(i, season.getTitle());
        EpisodeCardPresenter presenter = new EpisodeCardPresenter(getActivity());
        presenter.setOnClickListener(this);
        ArrayObjectAdapter episodes = new ArrayObjectAdapter(presenter);
        for (final Episode episode : season.getEpisodes()) {
            episodes.add(episode);
        }
        objectAdapter.add(new ListRow(header, episodes));
    }
    objectAdapter.notifyArrayItemRangeChanged(1, objectAdapter.size());
}
Also used : Episode(butter.droid.provider.base.model.Episode) ArrayObjectAdapter(android.support.v17.leanback.widget.ArrayObjectAdapter) HeaderItem(android.support.v17.leanback.widget.HeaderItem) Season(butter.droid.provider.base.model.Season) ListRow(android.support.v17.leanback.widget.ListRow) EpisodeCardPresenter(butter.droid.tv.ui.detail.show.presenter.EpisodeCardPresenter)

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