use of android.support.v17.leanback.widget.ListRow 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);
}
use of android.support.v17.leanback.widget.ListRow 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);
}
}
use of android.support.v17.leanback.widget.ListRow 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));
}
use of android.support.v17.leanback.widget.ListRow 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));
});
}
use of android.support.v17.leanback.widget.ListRow 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);
}
Aggregations