Search in sources :

Example 21 with ArrayObjectAdapter

use of android.support.v17.leanback.widget.ArrayObjectAdapter 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 22 with ArrayObjectAdapter

use of android.support.v17.leanback.widget.ArrayObjectAdapter in project ring-client-android by savoirfairelinux.

the class TVContactRequestFragment method setupAdapter.

private void setupAdapter() {
    // Set detail background and style.
    FullWidthDetailsOverviewRowPresenter detailsPresenter = new FullWidthDetailsOverviewRowPresenter(new TVContactRequestDetailPresenter(), new TVContactRequestDetailsOverviewLogoPresenter());
    detailsPresenter.setBackgroundColor(ContextCompat.getColor(getActivity(), R.color.color_primary_dark));
    detailsPresenter.setInitialState(FullWidthDetailsOverviewRowPresenter.STATE_HALF);
    // Hook up transition element.
    FullWidthDetailsOverviewSharedElementHelper mHelper = new FullWidthDetailsOverviewSharedElementHelper();
    mHelper.setSharedElementEnterTransition(getActivity(), TVContactRequestActivity.SHARED_ELEMENT_NAME);
    detailsPresenter.setListener(mHelper);
    detailsPresenter.setParticipatingEntranceTransition(false);
    prepareEntranceTransition();
    detailsPresenter.setOnActionClickedListener(action -> {
        if (action.getId() == ACTION_ACCEPT) {
            presenter.acceptTrustRequest(mSelectedContactRequest);
        } else if (action.getId() == ACTION_REFUSE) {
            presenter.refuseTrustRequest(mSelectedContactRequest);
        } else if (action.getId() == ACTION_BLOCK) {
            presenter.blockTrustRequest(mSelectedContactRequest);
        }
    });
    ClassPresenterSelector mPresenterSelector = new ClassPresenterSelector();
    mPresenterSelector.addClassPresenter(DetailsOverviewRow.class, detailsPresenter);
    mPresenterSelector.addClassPresenter(ListRow.class, new ListRowPresenter());
    mAdapter = new ArrayObjectAdapter(mPresenterSelector);
    setAdapter(mAdapter);
}
Also used : FullWidthDetailsOverviewRowPresenter(android.support.v17.leanback.widget.FullWidthDetailsOverviewRowPresenter) FullWidthDetailsOverviewSharedElementHelper(android.support.v17.leanback.widget.FullWidthDetailsOverviewSharedElementHelper) ListRowPresenter(android.support.v17.leanback.widget.ListRowPresenter) ArrayObjectAdapter(android.support.v17.leanback.widget.ArrayObjectAdapter) SparseArrayObjectAdapter(android.support.v17.leanback.widget.SparseArrayObjectAdapter) ClassPresenterSelector(android.support.v17.leanback.widget.ClassPresenterSelector)

Example 23 with ArrayObjectAdapter

use of android.support.v17.leanback.widget.ArrayObjectAdapter in project ring-client-android by savoirfairelinux.

the class RingSearchFragment method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mRowsAdapter = new ArrayObjectAdapter(new ListRowPresenter());
    setSearchResultProvider(this);
    // dependency injection
    ((RingApplication) getActivity().getApplication()).getRingInjectionComponent().inject(this);
    setOnItemViewClickedListener(new ItemViewClickedListener());
    setBadgeDrawable(ContextCompat.getDrawable(getActivity(), R.mipmap.ic_launcher));
}
Also used : ListRowPresenter(android.support.v17.leanback.widget.ListRowPresenter) OnItemViewClickedListener(android.support.v17.leanback.widget.OnItemViewClickedListener) ArrayObjectAdapter(android.support.v17.leanback.widget.ArrayObjectAdapter)

Example 24 with ArrayObjectAdapter

use of android.support.v17.leanback.widget.ArrayObjectAdapter in project butter-android by butterproject.

the class TVSearchFragment method onActivityCreated.

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    backgroundUpdater.initialise(getActivity(), R.color.black);
    listRowPresenter = new ListRowPresenter();
    listRowPresenter.setShadowEnabled(false);
    rowsAdapter = new ArrayObjectAdapter(listRowPresenter);
    setSearchResultProvider(this);
    setOnItemViewClickedListener(getDefaultItemClickedListener());
    setOnItemViewSelectedListener(new ItemViewSelectedListener());
    // setup row to use for loading
    loadingRow = createLoadingRow();
}
Also used : ListRowPresenter(android.support.v17.leanback.widget.ListRowPresenter) OnItemViewSelectedListener(android.support.v17.leanback.widget.OnItemViewSelectedListener) ArrayObjectAdapter(android.support.v17.leanback.widget.ArrayObjectAdapter)

Example 25 with ArrayObjectAdapter

use of android.support.v17.leanback.widget.ArrayObjectAdapter 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)

Aggregations

ArrayObjectAdapter (android.support.v17.leanback.widget.ArrayObjectAdapter)33 HeaderItem (android.support.v17.leanback.widget.HeaderItem)16 ListRow (android.support.v17.leanback.widget.ListRow)13 ListRowPresenter (android.support.v17.leanback.widget.ListRowPresenter)13 ClassPresenterSelector (android.support.v17.leanback.widget.ClassPresenterSelector)8 Intent (android.content.Intent)5 DetailsOverviewRow (android.support.v17.leanback.widget.DetailsOverviewRow)4 FullWidthDetailsOverviewRowPresenter (android.support.v17.leanback.widget.FullWidthDetailsOverviewRowPresenter)4 Card (cx.ring.tv.cards.Card)4 CardPresenterSelector (cx.ring.tv.cards.CardPresenterSelector)4 ContactCard (cx.ring.tv.cards.contacts.ContactCard)4 IconCard (cx.ring.tv.cards.iconcards.IconCard)4 Activity (android.app.Activity)3 Bundle (android.os.Bundle)3 OnItemViewClickedListener (android.support.v17.leanback.widget.OnItemViewClickedListener)3 VerticalGridPresenter (android.support.v17.leanback.widget.VerticalGridPresenter)3 MediaCardPresenter (butter.droid.tv.presenters.MediaCardPresenter)3 CardListRow (cx.ring.tv.cards.CardListRow)3 CardRow (cx.ring.tv.cards.CardRow)3 ContactRequestCard (cx.ring.tv.cards.contactrequests.ContactRequestCard)3