androidx.leanback.widget.OnActionClickedListener Java Examples

The following examples show how to use androidx.leanback.widget.OnActionClickedListener. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LiveDataDetailFragmentUiModule.java    From tv-samples with Apache License 2.0 6 votes vote down vote up
@Provides
@PerFragment
public FullWidthDetailsOverviewSharedElementHelper provideHelper(Activity activity,
        PresenterSelector mPs, DetailsOverviewRow row, OnActionClickedListener listener) {
    FullWidthDetailsOverviewSharedElementHelper mHelper =
            new FullWidthDetailsOverviewSharedElementHelper();
    mHelper.setSharedElementEnterTransition(activity,
            LiveDataDetailActivity.SHARED_ELEMENT_NAME);

    ((FullWidthDetailsOverviewRowPresenter) mPs.getPresenter(row))
            .setListener(mHelper);
    ((FullWidthDetailsOverviewRowPresenter) mPs.getPresenter(row))
            .setParticipatingEntranceTransition(false);
    ((FullWidthDetailsOverviewRowPresenter) mPs.getPresenter(row))
            .setOnActionClickedListener(listener);
    return mHelper;

}
 
Example #2
Source File: CustomPlaybackFragmentGlueHost.java    From jellyfin-androidtv with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void setOnActionClickedListener(OnActionClickedListener listener) {
    // Copy from superclass
    if (listener == null) {
        fragment.setOnPlaybackItemViewClickedListener(null);
    } else {
        fragment.setOnPlaybackItemViewClickedListener(new OnItemViewClickedListener() {
            @Override
            public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item,
                                      RowPresenter.ViewHolder rowViewHolder, Row row) {
                // Call our custom function and pass the view instance
                if (item instanceof CustomAction) {
                    ((CustomAction) item).onCustomActionClicked(itemViewHolder.view);
                }
                if (item instanceof Action) {
                    listener.onActionClicked((Action) item);
                }
            }
        });
    };
}
 
Example #3
Source File: VideoDetailsFragment.java    From tv-samples with Apache License 2.0 5 votes vote down vote up
private void setupAdapter() {
    // Set detail background and style.
    FullWidthDetailsOverviewRowPresenter detailsPresenter =
            new FullWidthDetailsOverviewRowPresenter(new DetailsDescriptionPresenter(),
                    new MovieDetailsOverviewLogoPresenter());

    detailsPresenter.setBackgroundColor(
            ContextCompat.getColor(getActivity(), R.color.selected_background));
    detailsPresenter.setInitialState(FullWidthDetailsOverviewRowPresenter.STATE_HALF);

    // Hook up transition element.
    mHelper = new FullWidthDetailsOverviewSharedElementHelper();
    mHelper.setSharedElementEnterTransition(getActivity(),
            VideoDetailsActivity.SHARED_ELEMENT_NAME);
    detailsPresenter.setListener(mHelper);
    detailsPresenter.setParticipatingEntranceTransition(false);
    prepareEntranceTransition();

    detailsPresenter.setOnActionClickedListener(new OnActionClickedListener() {
        @Override
        public void onActionClicked(Action action) {
            if (action.getId() == ACTION_WATCH_TRAILER) {
                Intent intent = new Intent(getActivity(), PlaybackActivity.class);
                intent.putExtra(VideoDetailsActivity.VIDEO, mSelectedVideo);
                startActivity(intent);
            } else {
                Toast.makeText(getActivity(), action.toString(), Toast.LENGTH_SHORT).show();
            }
        }
    });

    mPresenterSelector = new ClassPresenterSelector();
    mPresenterSelector.addClassPresenter(DetailsOverviewRow.class, detailsPresenter);
    mPresenterSelector.addClassPresenter(ListRow.class, new ListRowPresenter());
    mAdapter = new ArrayObjectAdapter(mPresenterSelector);
    setAdapter(mAdapter);
}
 
Example #4
Source File: VideoDetailsFragment.java    From androidtv-Leanback with Apache License 2.0 5 votes vote down vote up
private void setupAdapter() {
    // Set detail background and style.
    FullWidthDetailsOverviewRowPresenter detailsPresenter =
            new FullWidthDetailsOverviewRowPresenter(new DetailsDescriptionPresenter(),
                    new MovieDetailsOverviewLogoPresenter());

    detailsPresenter.setBackgroundColor(
            ContextCompat.getColor(getActivity(), R.color.selected_background));
    detailsPresenter.setInitialState(FullWidthDetailsOverviewRowPresenter.STATE_HALF);

    // Hook up transition element.
    mHelper = new FullWidthDetailsOverviewSharedElementHelper();
    mHelper.setSharedElementEnterTransition(getActivity(),
            VideoDetailsActivity.SHARED_ELEMENT_NAME);
    detailsPresenter.setListener(mHelper);
    detailsPresenter.setParticipatingEntranceTransition(false);
    prepareEntranceTransition();

    detailsPresenter.setOnActionClickedListener(new OnActionClickedListener() {
        @Override
        public void onActionClicked(Action action) {
            if (action.getId() == ACTION_WATCH_TRAILER) {
                Intent intent = new Intent(getActivity(), PlaybackActivity.class);
                intent.putExtra(VideoDetailsActivity.VIDEO, mSelectedVideo);
                startActivity(intent);
            } else {
                Toast.makeText(getActivity(), action.toString(), Toast.LENGTH_SHORT).show();
            }
        }
    });

    mPresenterSelector = new ClassPresenterSelector();
    mPresenterSelector.addClassPresenter(DetailsOverviewRow.class, detailsPresenter);
    mPresenterSelector.addClassPresenter(ListRow.class, new ListRowPresenter());
    mAdapter = new ArrayObjectAdapter(mPresenterSelector);
    setAdapter(mAdapter);
}
 
Example #5
Source File: LiveDataDetailFragmentSubComponent.java    From tv-samples with Apache License 2.0 4 votes vote down vote up
@BindsInstance
Builder actionClickedListener(OnActionClickedListener listener);