android.support.v17.leanback.widget.FullWidthDetailsOverviewRowPresenter Java Examples
The following examples show how to use
android.support.v17.leanback.widget.FullWidthDetailsOverviewRowPresenter.
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 leanback-showcase with Apache License 2.0 | 6 votes |
@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: VideoDetailsFragment.java From leanback-assistant with Apache License 2.0 | 5 votes |
private void setupAdapter() { FullWidthDetailsOverviewRowPresenter detailsPresenter = new FullWidthDetailsOverviewRowPresenter( new DetailsDescriptionPresenter(), new MovieDetailsOverviewLogoPresenter()); detailsPresenter.setBackgroundColor( ContextCompat.getColor(getContext(), R.color.background_dark)); detailsPresenter.setInitialState(FullWidthDetailsOverviewRowPresenter.STATE_HALF); detailsPresenter.setOnActionClickedListener( new OnActionClickedListener() { @Override public void onActionClicked(Action action) { if (action.getId() == ACTION_WATCH) { Intent intent = PlaybackActivity.createIntent(getContext(), mMovie.getId()); startActivity(intent); } else { Toast.makeText(getActivity(), action.toString(), Toast.LENGTH_SHORT) .show(); } } }); ClassPresenterSelector mPresenterSelector = new ClassPresenterSelector(); mPresenterSelector.addClassPresenter(DetailsOverviewRow.class, detailsPresenter); mAdapter = new ArrayObjectAdapter(mPresenterSelector); setAdapter(mAdapter); }
Example #3
Source File: PresenterModule.java From leanback-showcase with Apache License 2.0 | 5 votes |
@PerFragment @Provides @IntoMap @PresenterSelectorKey(DetailsOverviewRow.class) public Presenter provideDetailsOverviewRowPresenter() { DetailsDescriptionPresenter pre = new DetailsDescriptionPresenter(); return new FullWidthDetailsOverviewRowPresenter(pre); }
Example #4
Source File: VideoDetailsFragment.java From leanback-assistant with Apache License 2.0 | 4 votes |
public FullWidthDetailsOverviewRowPresenter getParentPresenter() { return mParentPresenter; }
Example #5
Source File: VideoDetailsFragment.java From leanback-assistant with Apache License 2.0 | 4 votes |
public FullWidthDetailsOverviewRowPresenter.ViewHolder getParentViewHolder() { return mParentViewHolder; }
Example #6
Source File: VideoDetailsFragment.java From android-tv-leanback with Apache License 2.0 | 4 votes |
@Override protected void onPostExecute(DetailsOverviewRow detailRow) { ClassPresenterSelector ps = new ClassPresenterSelector(); FullWidthDetailsOverviewRowPresenter detailsPresenter = new FullWidthDetailsOverviewRowPresenter(new DetailsDescriptionPresenter(getContext())); detailsPresenter.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.primary)); detailsPresenter.setInitialState(FullWidthDetailsOverviewRowPresenter.STATE_FULL); detailsPresenter.setOnActionClickedListener(new OnActionClickedListener() { @Override public void onActionClicked(Action action) { if (action.getId() == ACTION_PLAY) { Intent intent = new Intent(getActivity(), PlayerActivity.class); intent.putExtra(Video.INTENT_EXTRA_VIDEO, selectedVideo); startActivity(intent); } else { Toast.makeText(getActivity(), action.toString(), Toast.LENGTH_SHORT).show(); } } }); ps.addClassPresenter(DetailsOverviewRow.class, detailsPresenter); ps.addClassPresenter(ListRow.class, new ListRowPresenter()); /** bonus code for adding related items to details fragment **/ // <START> ArrayObjectAdapter adapter = new ArrayObjectAdapter(ps); adapter.add(detailRow); String subcategories[] = { "You may also like" }; CursorObjectAdapter rowAdapter = new CursorObjectAdapter(new SinglePresenterSelector(new CardPresenter())); VideoDataManager manager = new VideoDataManager(getActivity(), getLoaderManager(), VideoItemContract.VideoItem.buildDirUri(), rowAdapter); manager.startDataLoading(); HeaderItem header = new HeaderItem(0, subcategories[0]); adapter.add(new ListRow(header, rowAdapter)); setAdapter(adapter); // <END> }
Example #7
Source File: VideoDetailsFragment.java From android-tv-leanback with Apache License 2.0 | 4 votes |
@Override protected void onPostExecute(DetailsOverviewRow detailRow) { ClassPresenterSelector ps = new ClassPresenterSelector(); FullWidthDetailsOverviewRowPresenter detailsPresenter = new FullWidthDetailsOverviewRowPresenter(new DetailsDescriptionPresenter(getContext())); detailsPresenter.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.primary)); detailsPresenter.setInitialState(FullWidthDetailsOverviewRowPresenter.STATE_FULL); detailsPresenter.setOnActionClickedListener(new OnActionClickedListener() { @Override public void onActionClicked(Action action) { if (action.getId() == ACTION_PLAY) { Intent intent = new Intent(getActivity(), PlayerActivity.class); intent.putExtra(Video.INTENT_EXTRA_VIDEO, selectedVideo); startActivity(intent); } else { Toast.makeText(getActivity(), action.toString(), Toast.LENGTH_SHORT).show(); } } }); ps.addClassPresenter(DetailsOverviewRow.class, detailsPresenter); ps.addClassPresenter(ListRow.class, new ListRowPresenter()); /** bonus code for adding related items to details fragment **/ // <START> ArrayObjectAdapter adapter = new ArrayObjectAdapter(ps); adapter.add(detailRow); String subcategories[] = { "You may also like" }; CursorObjectAdapter rowAdapter = new CursorObjectAdapter(new SinglePresenterSelector(new CardPresenter())); VideoDataManager manager = new VideoDataManager(getActivity(), getLoaderManager(), VideoItemContract.VideoItem.buildDirUri(), rowAdapter); manager.startDataLoading(); HeaderItem header = new HeaderItem(0, subcategories[0]); adapter.add(new ListRow(header, rowAdapter)); setAdapter(adapter); // <END> }
Example #8
Source File: VideoDetailsFragment.java From android-tv-leanback with Apache License 2.0 | 4 votes |
@Override protected void onPostExecute(DetailsOverviewRow detailRow) { ClassPresenterSelector ps = new ClassPresenterSelector(); FullWidthDetailsOverviewRowPresenter detailsPresenter = new FullWidthDetailsOverviewRowPresenter(new DetailsDescriptionPresenter(getContext())); detailsPresenter.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.primary)); detailsPresenter.setInitialState(FullWidthDetailsOverviewRowPresenter.STATE_FULL); detailsPresenter.setOnActionClickedListener(new OnActionClickedListener() { @Override public void onActionClicked(Action action) { if (action.getId() == ACTION_PLAY) { Intent intent = new Intent(getActivity(), PlayerActivity.class); intent.putExtra(Video.INTENT_EXTRA_VIDEO, selectedVideo); startActivity(intent); } else { Toast.makeText(getActivity(), action.toString(), Toast.LENGTH_SHORT).show(); } } }); ps.addClassPresenter(DetailsOverviewRow.class, detailsPresenter); ps.addClassPresenter(ListRow.class, new ListRowPresenter()); /** bonus code for adding related items to details fragment **/ // <START> ArrayObjectAdapter adapter = new ArrayObjectAdapter(ps); adapter.add(detailRow); String subcategories[] = { "You may also like" }; CursorObjectAdapter rowAdapter = new CursorObjectAdapter(new SinglePresenterSelector(new CardPresenter())); VideoDataManager manager = new VideoDataManager(getActivity(), getLoaderManager(), VideoItemContract.VideoItem.buildDirUri(), rowAdapter); manager.startDataLoading(); HeaderItem header = new HeaderItem(0, subcategories[0]); adapter.add(new ListRow(header, rowAdapter)); setAdapter(adapter); // <END> }
Example #9
Source File: VideoDetailsFragment.java From android-tv-leanback with Apache License 2.0 | 4 votes |
@Override protected void onPostExecute(DetailsOverviewRow detailRow) { ClassPresenterSelector ps = new ClassPresenterSelector(); FullWidthDetailsOverviewRowPresenter detailsPresenter = new FullWidthDetailsOverviewRowPresenter(new DetailsDescriptionPresenter(getContext())); detailsPresenter.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.primary)); detailsPresenter.setInitialState(FullWidthDetailsOverviewRowPresenter.STATE_FULL); detailsPresenter.setOnActionClickedListener(new OnActionClickedListener() { @Override public void onActionClicked(Action action) { if (action.getId() == ACTION_PLAY) { Intent intent = new Intent(getActivity(), PlayerActivity.class); intent.putExtra(Video.INTENT_EXTRA_VIDEO, selectedVideo); startActivity(intent); } else { Toast.makeText(getActivity(), action.toString(), Toast.LENGTH_SHORT).show(); } } }); ps.addClassPresenter(DetailsOverviewRow.class, detailsPresenter); ps.addClassPresenter(ListRow.class, new ListRowPresenter()); /** bonus code for adding related items to details fragment **/ // <START> ArrayObjectAdapter adapter = new ArrayObjectAdapter(ps); adapter.add(detailRow); String subcategories[] = { "You may also like" }; CursorObjectAdapter rowAdapter = new CursorObjectAdapter(new SinglePresenterSelector(new CardPresenter())); VideoDataManager manager = new VideoDataManager(getActivity(), getLoaderManager(), VideoItemContract.VideoItem.buildDirUri(), rowAdapter); manager.startDataLoading(); HeaderItem header = new HeaderItem(0, subcategories[0]); adapter.add(new ListRow(header, rowAdapter)); setAdapter(adapter); // <END> }