Search in sources :

Example 11 with HeaderItem

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);
}
Also used : ListRowPresenter(android.support.v17.leanback.widget.ListRowPresenter) ArrayObjectAdapter(android.support.v17.leanback.widget.ArrayObjectAdapter) HeaderItem(android.support.v17.leanback.widget.HeaderItem) ListRow(android.support.v17.leanback.widget.ListRow)

Example 12 with HeaderItem

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());
}
Also used : CardListRow(cx.ring.tv.cards.CardListRow) CardRow(cx.ring.tv.cards.CardRow) OnItemViewClickedListener(android.support.v17.leanback.widget.OnItemViewClickedListener) ArrayList(java.util.ArrayList) CardPresenterSelector(cx.ring.tv.cards.CardPresenterSelector) Intent(android.content.Intent) ArrayObjectAdapter(android.support.v17.leanback.widget.ArrayObjectAdapter) HeaderItem(android.support.v17.leanback.widget.HeaderItem) ShadowRowPresenterSelector(cx.ring.tv.cards.ShadowRowPresenterSelector) DisplayMetrics(android.util.DisplayMetrics) VCard(ezvcard.VCard) IconCard(cx.ring.tv.cards.iconcards.IconCard) ContactRequestCard(cx.ring.tv.cards.contactrequests.ContactRequestCard) ContactCard(cx.ring.tv.cards.contacts.ContactCard) Card(cx.ring.tv.cards.Card)

Example 13 with HeaderItem

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);
}
Also used : CardListRow(cx.ring.tv.cards.CardListRow) CardRow(cx.ring.tv.cards.CardRow) ArrayList(java.util.ArrayList) CardPresenterSelector(cx.ring.tv.cards.CardPresenterSelector) ArrayObjectAdapter(android.support.v17.leanback.widget.ArrayObjectAdapter) HeaderItem(android.support.v17.leanback.widget.HeaderItem) VCard(ezvcard.VCard) IconCard(cx.ring.tv.cards.iconcards.IconCard) ContactRequestCard(cx.ring.tv.cards.contactrequests.ContactRequestCard) ContactCard(cx.ring.tv.cards.contacts.ContactCard) Card(cx.ring.tv.cards.Card)

Example 14 with HeaderItem

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;
}
Also used : HeaderItem(android.support.v17.leanback.widget.HeaderItem) ArrayObjectAdapter(android.support.v17.leanback.widget.ArrayObjectAdapter) MorePresenter(butter.droid.tv.presenters.MorePresenter) ListRow(android.support.v17.leanback.widget.ListRow)

Example 15 with HeaderItem

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

Aggregations

HeaderItem (android.support.v17.leanback.widget.HeaderItem)17 ArrayObjectAdapter (android.support.v17.leanback.widget.ArrayObjectAdapter)16 ListRow (android.support.v17.leanback.widget.ListRow)14 ListRowPresenter (android.support.v17.leanback.widget.ListRowPresenter)4 CardPresenterSelector (cx.ring.tv.cards.CardPresenterSelector)4 ContactCard (cx.ring.tv.cards.contacts.ContactCard)4 MediaCardPresenter (butter.droid.tv.presenters.MediaCardPresenter)3 Card (cx.ring.tv.cards.Card)3 CardListRow (cx.ring.tv.cards.CardListRow)3 CardRow (cx.ring.tv.cards.CardRow)3 ContactRequestCard (cx.ring.tv.cards.contactrequests.ContactRequestCard)3 IconCard (cx.ring.tv.cards.iconcards.IconCard)3 VCard (ezvcard.VCard)3 ClassPresenterSelector (android.support.v17.leanback.widget.ClassPresenterSelector)2 LoadingCardPresenter (butter.droid.tv.presenters.LoadingCardPresenter)2 LoadingCardItem (butter.droid.tv.presenters.LoadingCardPresenter.LoadingCardItem)2 MorePresenter (butter.droid.tv.presenters.MorePresenter)2 ShadowRowPresenterSelector (cx.ring.tv.cards.ShadowRowPresenterSelector)2 ArrayList (java.util.ArrayList)2 SearchAggregate (org.videolan.medialibrary.media.SearchAggregate)2