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