Search in sources :

Example 1 with FullWidthDetailsOverviewSharedElementHelper

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

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

the class TVBaseDetailsFragment method setupDetailsOverviewRowPresenter.

private void setupDetailsOverviewRowPresenter(MediaWrapper item) {
    // Set detail background and style.
    FullWidthDetailsOverviewRowPresenter detailsPresenter = new FullWidthDetailsOverviewRowPresenter(getDetailPresenter());
    if (item.hasColor()) {
        detailsPresenter.setBackgroundColor(item.getColor());
    }
    detailsPresenter.setOnActionClickedListener(this);
    final FullWidthDetailsOverviewSharedElementHelper sharedElementHelper = new FullWidthDetailsOverviewSharedElementHelper();
    sharedElementHelper.setSharedElementEnterTransition(getActivity(), TVMediaDetailActivity.SHARED_ELEMENT_NAME);
    detailsPresenter.setListener(sharedElementHelper);
    detailsPresenter.setParticipatingEntranceTransition(false);
    presenterSelector.addClassPresenter(DetailsOverviewRow.class, detailsPresenter);
    presenterSelector.addClassPresenter(ListRow.class, new ListRowPresenter());
}
Also used : FullWidthDetailsOverviewRowPresenter(android.support.v17.leanback.widget.FullWidthDetailsOverviewRowPresenter) FullWidthDetailsOverviewSharedElementHelper(android.support.v17.leanback.widget.FullWidthDetailsOverviewSharedElementHelper) ListRowPresenter(android.support.v17.leanback.widget.ListRowPresenter)

Aggregations

FullWidthDetailsOverviewRowPresenter (android.support.v17.leanback.widget.FullWidthDetailsOverviewRowPresenter)2 FullWidthDetailsOverviewSharedElementHelper (android.support.v17.leanback.widget.FullWidthDetailsOverviewSharedElementHelper)2 ListRowPresenter (android.support.v17.leanback.widget.ListRowPresenter)2 ArrayObjectAdapter (android.support.v17.leanback.widget.ArrayObjectAdapter)1 ClassPresenterSelector (android.support.v17.leanback.widget.ClassPresenterSelector)1 SparseArrayObjectAdapter (android.support.v17.leanback.widget.SparseArrayObjectAdapter)1