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