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);
}
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;
}
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);
}
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);
}
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());
}
Aggregations