use of android.support.v17.leanback.widget.HeaderItem 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);
}
use of android.support.v17.leanback.widget.HeaderItem in project ring-client-android by savoirfairelinux.
the class MainFragment method setupUIElements.
private void setupUIElements() {
mBackgroundManager = BackgroundManager.getInstance(getActivity());
mBackgroundManager.attach(getActivity().getWindow());
mMetrics = new DisplayMetrics();
getActivity().getWindowManager().getDefaultDisplay().getMetrics(mMetrics);
// over title
setHeadersState(HEADERS_ENABLED);
setHeadersTransitionOnBackEnabled(true);
// set fastLane (or headers) background color
setBrandColor(getResources().getColor(R.color.color_primary_dark));
// set search icon color
setSearchAffordanceColor(getResources().getColor(R.color.color_primary_light));
mRowsAdapter = new ArrayObjectAdapter(new ShadowRowPresenterSelector());
/* Contact Presenter */
List<Card> cards = new ArrayList<>();
CardRow contactRow = new CardRow(CardRow.TYPE_DEFAULT, true, getString(R.string.tv_contact_row_header), cards);
HeaderItem cardPresenterHeader = new HeaderItem(HEADER_CONTACTS, getString(R.string.tv_contact_row_header));
cardRowAdapter = new ArrayObjectAdapter(new CardPresenterSelector(getActivity()));
CardListRow contactListRow = new CardListRow(cardPresenterHeader, cardRowAdapter, contactRow);
/* CardPresenter */
mRowsAdapter.add(contactListRow);
mRowsAdapter.add(createMyAccountRow());
mRowsAdapter.add(createAboutCardRow());
setAdapter(mRowsAdapter);
// listeners
setOnSearchClickedListener(view -> {
Intent intent = new Intent(getActivity(), SearchActivity.class);
startActivity(intent);
});
setOnItemViewClickedListener(new ItemViewClickedListener());
}
use of android.support.v17.leanback.widget.HeaderItem in project ring-client-android by savoirfairelinux.
the class MainFragment method createContactRequestRow.
private Row createContactRequestRow() {
List<Card> cards = new ArrayList<>();
CardRow contactRequestRow = new CardRow(CardRow.TYPE_DEFAULT, true, getString(R.string.menu_item_contact_request), cards);
contactRequestRowAdapter = new ArrayObjectAdapter(new CardPresenterSelector(getActivity()));
return new CardListRow(new HeaderItem(HEADER_MISC, getString(R.string.menu_item_contact_request)), contactRequestRowAdapter, contactRequestRow);
}
use of android.support.v17.leanback.widget.HeaderItem in project butter-android by butterproject.
the class TVOverviewFragment method addMoreOptionsAdapter.
private ArrayObjectAdapter addMoreOptionsAdapter() {
HeaderItem moreOptionsHeader = new HeaderItem(getString(R.string.more_movies));
MorePresenter morePresenter = new MorePresenter(requireContext());
ArrayObjectAdapter moreOptionsAdapter = new ArrayObjectAdapter(morePresenter);
rowsAdapter.add(new ListRow(moreOptionsHeader, moreOptionsAdapter));
return moreOptionsAdapter;
}
use of android.support.v17.leanback.widget.HeaderItem 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;
}
Aggregations