androidx.leanback.widget.ListRowPresenter Java Examples
The following examples show how to use
androidx.leanback.widget.ListRowPresenter.
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: PlaybackFragment.java From androidtv-Leanback with Apache License 2.0 | 6 votes |
private ArrayObjectAdapter initializeRelatedVideosRow() { /* * To add a new row to the mPlayerAdapter and not lose the controls row that is provided by the * glue, we need to compose a new row with the controls row and our related videos row. * * We start by creating a new {@link ClassPresenterSelector}. Then add the controls row from * the media player glue, then add the related videos row. */ ClassPresenterSelector presenterSelector = new ClassPresenterSelector(); presenterSelector.addClassPresenter( mPlayerGlue.getControlsRow().getClass(), mPlayerGlue.getPlaybackRowPresenter()); presenterSelector.addClassPresenter(ListRow.class, new ListRowPresenter()); ArrayObjectAdapter rowsAdapter = new ArrayObjectAdapter(presenterSelector); rowsAdapter.add(mPlayerGlue.getControlsRow()); HeaderItem header = new HeaderItem(getString(R.string.related_movies)); ListRow row = new ListRow(header, mVideoCursorAdapter); rowsAdapter.add(row); setOnItemViewClickedListener(new ItemViewClickedListener()); return rowsAdapter; }
Example #2
Source File: MainFragment.java From androidtv-Leanback with Apache License 2.0 | 6 votes |
@Override public void onActivityCreated(Bundle savedInstanceState) { // Final initialization, modifying UI elements. super.onActivityCreated(savedInstanceState); // Prepare the manager that maintains the same background image between activities. prepareBackgroundManager(); setupUIElements(); setupEventListeners(); prepareEntranceTransition(); // Map category results from the database to ListRow objects. // This Adapter is used to render the MainFragment sidebar labels. mCategoryRowAdapter = new ArrayObjectAdapter(new ListRowPresenter()); setAdapter(mCategoryRowAdapter); updateRecommendations(); }
Example #3
Source File: MainFragment.java From tv-samples with Apache License 2.0 | 6 votes |
@Override public void onActivityCreated(Bundle savedInstanceState) { // Final initialization, modifying UI elements. super.onActivityCreated(savedInstanceState); // Prepare the manager that maintains the same background image between activities. prepareBackgroundManager(); setupUIElements(); setupEventListeners(); prepareEntranceTransition(); // Map category results from the database to ListRow objects. // This Adapter is used to render the MainFragment sidebar labels. mCategoryRowAdapter = new ArrayObjectAdapter(new ListRowPresenter()); setAdapter(mCategoryRowAdapter); updateRecommendations(); }
Example #4
Source File: PlaybackFragment.java From tv-samples with Apache License 2.0 | 6 votes |
private ArrayObjectAdapter initializeRelatedVideosRow() { /* * To add a new row to the mPlayerAdapter and not lose the controls row that is provided by the * glue, we need to compose a new row with the controls row and our related videos row. * * We start by creating a new {@link ClassPresenterSelector}. Then add the controls row from * the media player glue, then add the related videos row. */ ClassPresenterSelector presenterSelector = new ClassPresenterSelector(); presenterSelector.addClassPresenter( mPlayerGlue.getControlsRow().getClass(), mPlayerGlue.getPlaybackRowPresenter()); presenterSelector.addClassPresenter(ListRow.class, new ListRowPresenter()); ArrayObjectAdapter rowsAdapter = new ArrayObjectAdapter(presenterSelector); rowsAdapter.add(mPlayerGlue.getControlsRow()); HeaderItem header = new HeaderItem(getString(R.string.related_movies)); ListRow row = new ListRow(header, mVideoCursorAdapter); rowsAdapter.add(row); setOnItemViewClickedListener(new ItemViewClickedListener()); return rowsAdapter; }
Example #5
Source File: ProviderTvFragment.java From xipl with Apache License 2.0 | 6 votes |
/** * Shows the different rows of the Fragment. */ private void showRows() { Map<String, RowsSupportFragment> tempMap = getFragmentMap(); mRowsAdapter = new ArrayObjectAdapter(new ListRowPresenter()); int i = 0; for (Map.Entry<String, RowsSupportFragment> entry : tempMap.entrySet()) { HeaderItem header = new HeaderItem(i, entry.getKey()); PageRow row = new PageRow(header); mRowsAdapter.add(row); mFragmentSparseArray.append(i, entry.getValue()); i++; } setAdapter(mRowsAdapter); }
Example #6
Source File: PresenterModule.java From tv-samples with Apache License 2.0 | 5 votes |
@PerFragment @Provides @IntoMap @PresenterSelectorKey(ListRow.class) public Presenter provideListRowPresenter() { return new ListRowPresenter(); }
Example #7
Source File: SearchFragment.java From androidtv-Leanback with Apache License 2.0 | 5 votes |
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mRowsAdapter = new ArrayObjectAdapter(new ListRowPresenter()); mVideoCursorAdapter.setMapper(new VideoCursorMapper()); setSearchResultProvider(this); setOnItemViewClickedListener(new ItemViewClickedListener()); if (DEBUG) { Log.d(TAG, "User is initiating a search. Do we have RECORD_AUDIO permission? " + hasPermission(Manifest.permission.RECORD_AUDIO)); } if (!hasPermission(Manifest.permission.RECORD_AUDIO)) { if (DEBUG) { Log.d(TAG, "Does not have RECORD_AUDIO, using SpeechRecognitionCallback"); } // SpeechRecognitionCallback is not required and if not provided recognition will be // handled using internal speech recognizer, in which case you must have RECORD_AUDIO // permission setSpeechRecognitionCallback(new SpeechRecognitionCallback() { @Override public void recognizeSpeech() { try { startActivityForResult(getRecognizerIntent(), REQUEST_SPEECH); } catch (ActivityNotFoundException e) { Log.e(TAG, "Cannot find activity for speech recognizer", e); } } }); } else if (DEBUG) { Log.d(TAG, "We DO have RECORD_AUDIO"); } }
Example #8
Source File: VideoDetailsFragment.java From androidtv-Leanback with Apache License 2.0 | 5 votes |
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 #9
Source File: ProviderSettingsTvFragment.java From xipl with Apache License 2.0 | 5 votes |
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mRowsAdapter = new ArrayObjectAdapter(new ListRowPresenter()); mRowsAdapter.add(new ListRow(getSettingsObjectAdapter())); setAdapter(mRowsAdapter); setOnItemViewClickedListener(new SettingsItemClickListener()); }
Example #10
Source File: ProviderSearchFragment.java From xipl with Apache License 2.0 | 5 votes |
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mRowsAdapter = new ArrayObjectAdapter(new ListRowPresenter()); mEmptyResultsView = View.inflate(getActivity(), R.layout.view_content_unavailable, null); TextView textView = mEmptyResultsView.findViewById(R.id.view_content_unavailable_textview); textView.setText(R.string.no_results_found); setSearchResultProvider(this); setOnItemViewClickedListener(new AvContentTvItemClickListener(getPlaybackActivity())); }
Example #11
Source File: VodTvSectionFragment.java From xipl with Apache License 2.0 | 5 votes |
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mRowsAdapter = new ArrayObjectAdapter(new ListRowPresenter()); mProgressBarManager = ((BrowseSupportFragment) getParentFragment()).getProgressBarManager(); mScaleFrameLayout = getActivity().findViewById(R.id.scale_frame); mProgressBarManager.setRootView((ViewGroup) getActivity().findViewById(R.id.browse_container_dock)); setOnItemViewClickedListener(new AvContentTvItemClickListener(getPlaybackActivity())); setAdapter(mRowsAdapter); showRowsAdapter(); mAsyncProcessAvContent = new AsyncProcessAvContent(); mAsyncProcessAvContent.execute(); }
Example #12
Source File: SearchFragment.java From tv-samples with Apache License 2.0 | 5 votes |
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mRowsAdapter = new ArrayObjectAdapter(new ListRowPresenter()); mVideoCursorAdapter.setMapper(new VideoCursorMapper()); setSearchResultProvider(this); setOnItemViewClickedListener(new ItemViewClickedListener()); if (DEBUG) { Log.d(TAG, "User is initiating a search. Do we have RECORD_AUDIO permission? " + hasPermission(Manifest.permission.RECORD_AUDIO)); } if (!hasPermission(Manifest.permission.RECORD_AUDIO)) { if (DEBUG) { Log.d(TAG, "Does not have RECORD_AUDIO, using SpeechRecognitionCallback"); } // SpeechRecognitionCallback is not required and if not provided recognition will be // handled using internal speech recognizer, in which case you must have RECORD_AUDIO // permission setSpeechRecognitionCallback(new SpeechRecognitionCallback() { @Override public void recognizeSpeech() { try { startActivityForResult(getRecognizerIntent(), REQUEST_SPEECH); } catch (ActivityNotFoundException e) { Log.e(TAG, "Cannot find activity for speech recognizer", e); } } }); } else if (DEBUG) { Log.d(TAG, "We DO have RECORD_AUDIO"); } }
Example #13
Source File: VideoDetailsFragment.java From tv-samples with Apache License 2.0 | 5 votes |
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 #14
Source File: PageAndListRowFragment.java From tv-samples with Apache License 2.0 | 5 votes |
private void loadData() { mRowsAdapter = new ArrayObjectAdapter(new ListRowPresenter()); setAdapter(mRowsAdapter); new Handler().postDelayed(new Runnable() { @Override public void run() { createRows(); startEntranceTransition(); } }, 2000); }
Example #15
Source File: LiveDataRowPresenter.java From tv-samples with Apache License 2.0 | 5 votes |
@Override protected LiveDataRowPresenterViewHolder createRowViewHolder(ViewGroup parent) { ListRowPresenter.ViewHolder listRowPresenterViewHolder = (ListRowPresenter.ViewHolder) super.createRowViewHolder(parent); return new LiveDataRowPresenterViewHolder( listRowPresenterViewHolder.view, listRowPresenterViewHolder.getGridView(), listRowPresenterViewHolder.getListRowPresenter()); }
Example #16
Source File: SearchProvider.java From jellyfin-androidtv with GNU General Public License v2.0 | 4 votes |
SearchProvider(Context context, boolean musicOnly) { mRowsAdapter = new ArrayObjectAdapter(new ListRowPresenter()); mDelayedLoad = new SearchRunnable(context, mRowsAdapter, musicOnly); }
Example #17
Source File: BasePresenterSelector.java From LeanbackTvSample with MIT License | 4 votes |
public void enable(ListRowPresenter listRowPresenter, boolean flag) { listRowPresenter.setSelectEffectEnabled(flag); listRowPresenter.setShadowEnabled(flag); listRowPresenter.setKeepChildForeground(flag); }
Example #18
Source File: PageAndListRowFragment.java From tv-samples with Apache License 2.0 | 4 votes |
public SettingsFragment() { ListRowPresenter selector = new ListRowPresenter(); selector.setNumRows(2); mRowsAdapter = new ArrayObjectAdapter(selector); setAdapter(mRowsAdapter); }
Example #19
Source File: LiveDataRowPresenter.java From tv-samples with Apache License 2.0 | 4 votes |
public LiveDataRowPresenterViewHolder(View rootView, HorizontalGridView gridView, ListRowPresenter p) { super(rootView, gridView, p); }
Example #20
Source File: MainFragment.java From tv-samples with Apache License 2.0 | 4 votes |
private void setupRowAdapter() { mRowsAdapter = new ArrayObjectAdapter(new ListRowPresenter()); createRows(); setAdapter(mRowsAdapter); }