androidx.leanback.widget.ListRow Java Examples
The following examples show how to use
androidx.leanback.widget.ListRow.
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: SelectServerFragment.java From jellyfin-androidtv with GNU General Public License v2.0 | 6 votes |
@Override protected void addAdditionalRows(ArrayObjectAdapter rowAdapter) { super.addAdditionalRows(rowAdapter); HeaderItem serverHeader = new HeaderItem(rowAdapter.size(), mApplication.getString(R.string.lbl_select_server)); ItemRowAdapter serverAdapter = new ItemRowAdapter(mServers.toArray(new ServerInfo[0]), new CardPresenter(), rowAdapter); serverAdapter.Retrieve(); rowAdapter.add(new ListRow(serverHeader, serverAdapter)); HeaderItem gridHeader = new HeaderItem(rowAdapter.size(), mApplication.getString(R.string.lbl_other_options)); GridButtonPresenter mGridPresenter = new GridButtonPresenter(); ArrayObjectAdapter gridRowAdapter = new ArrayObjectAdapter(mGridPresenter); gridRowAdapter.add(new GridButton(ENTER_MANUALLY, mApplication.getString(R.string.lbl_enter_manually), R.drawable.tile_edit)); rowAdapter.add(new ListRow(gridHeader, gridRowAdapter)); }
Example #2
Source File: FullDetailsActivity.java From jellyfin-androidtv with GNU General Public License v2.0 | 6 votes |
@Override protected void onPostExecute(MyDetailsOverviewRow detailsOverviewRow) { super.onPostExecute(detailsOverviewRow); if (isFinishing()) return; ClassPresenterSelector ps = new ClassPresenterSelector(); ps.addClassPresenter(MyDetailsOverviewRow.class, mDorPresenter); mListRowPresenter = new CustomListRowPresenter(getDrawable(R.color.black_transparent_light), Utils.convertDpToPixel(mActivity, 10)); ps.addClassPresenter(ListRow.class, mListRowPresenter); mRowsAdapter = new ArrayObjectAdapter(ps); mRowsFragment.setAdapter(mRowsAdapter); mRowsAdapter.add(detailsOverviewRow); updateInfo(detailsOverviewRow.getItem()); addAdditionalRows(mRowsAdapter); }
Example #3
Source File: CustomBrowseFragment.java From jellyfin-androidtv with GNU General Public License v2.0 | 6 votes |
@Override public void onResume() { super.onResume(); //Re-retrieve anything that needs it but delay slightly so we don't take away gui landing if (mRowsAdapter != null) { new Handler().postDelayed(new Runnable() { @Override public void run() { for (int i = 0; i < mRowsAdapter.size(); i++) { if (mRowsAdapter.get(i) instanceof ListRow) { if (((ListRow) mRowsAdapter.get(i)).getAdapter() instanceof ItemRowAdapter) { ((ItemRowAdapter) ((ListRow) mRowsAdapter.get(i)).getAdapter()).ReRetrieveIfNeeded(); } } } } },1500); } }
Example #4
Source File: FullDetailsActivity.java From jellyfin-androidtv with GNU General Public License v2.0 | 6 votes |
private void addInfoRows(ArrayObjectAdapter adapter) { if (TvApp.getApplication().getUserPreferences().get(UserPreferences.Companion.getDebuggingEnabled()) && mBaseItem.getMediaSources() != null) { for (MediaSourceInfo ms : mBaseItem.getMediaSources()) { if (ms.getMediaStreams() != null && ms.getMediaStreams().size() > 0) { HeaderItem header = new HeaderItem("Media Details"+(ms.getContainer() != null ? " (" +ms.getContainer()+")" : "")); ArrayObjectAdapter infoAdapter = new ArrayObjectAdapter(new InfoCardPresenter()); for (MediaStream stream : ms.getMediaStreams()) { infoAdapter.add(stream); } adapter.add(new ListRow(header, infoAdapter)); } } } }
Example #5
Source File: BrowseViewFragment.java From jellyfin-androidtv with GNU General Public License v2.0 | 6 votes |
@Override protected void addAdditionalRows(ArrayObjectAdapter rowAdapter) { if (isLiveTvLibrary) { //Views row HeaderItem gridHeader = new HeaderItem(mRowsAdapter.size(), mApplication.getString(R.string.lbl_views)); GridButtonPresenter mGridPresenter = new GridButtonPresenter(); ArrayObjectAdapter gridRowAdapter = new ArrayObjectAdapter(mGridPresenter); gridRowAdapter.add(new GridButton(TvApp.LIVE_TV_RECORDINGS_OPTION_ID, TvApp.getApplication().getResources().getString(R.string.lbl_recorded_tv), R.drawable.tile_port_record)); if (mApplication.canManageRecordings()) { gridRowAdapter.add(new GridButton(TvApp.LIVE_TV_SCHEDULE_OPTION_ID, TvApp.getApplication().getResources().getString(R.string.lbl_schedule), R.drawable.tile_port_time)); gridRowAdapter.add(new GridButton(TvApp.LIVE_TV_SERIES_OPTION_ID, TvApp.getApplication().getResources().getString(R.string.lbl_series), R.drawable.tile_port_series_timer)); } mRowsAdapter.add(new ListRow(gridHeader, gridRowAdapter)); } else { super.addAdditionalRows(rowAdapter); } }
Example #6
Source File: SearchFragment.java From tv-samples with Apache License 2.0 | 6 votes |
@Override public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) { int titleRes; if (cursor != null && cursor.moveToFirst()) { mResultsFound = true; titleRes = R.string.search_results; } else { mResultsFound = false; titleRes = R.string.no_search_results; } mVideoCursorAdapter.changeCursor(cursor); HeaderItem header = new HeaderItem(getString(titleRes, mQuery)); mRowsAdapter.clear(); ListRow row = new ListRow(header, mVideoCursorAdapter); mRowsAdapter.add(row); }
Example #7
Source File: ItemRowAdapter.java From jellyfin-androidtv with GNU General Public License v2.0 | 6 votes |
public void removeRow() { if (mParent == null) { // just clear us clear(); return; } if (mParent.size() == 1) { // we will be removing the last row - show something and prevent the framework from crashing // because there is nowhere for focus to land ArrayObjectAdapter emptyRow = new ArrayObjectAdapter(new TextItemPresenter()); emptyRow.add(TvApp.getApplication().getString(R.string.lbl_no_items)); mParent.add(new ListRow(new HeaderItem(TvApp.getApplication().getString(R.string.lbl_empty)), emptyRow)); } mParent.remove(mRow); }
Example #8
Source File: VodTvSectionFragment.java From xipl with Apache License 2.0 | 6 votes |
/** * Updates the content shown to the user. */ private void updateRowsAdapter() { Map<String, List<AvContent>> tempMap = getContentsByGroup(); if (!tempMap.isEmpty()) { Set<String> groups = tempMap.keySet(); int i = 0; int rowsAdapterSize = mRowsAdapter.size(); mProgressBarManager.hide(); for (String group : groups) { // It might be possible that a new content row is being added while the rows have been generated. if (i >= rowsAdapterSize) { addContentRow(tempMap, group); } else { ListRow tempListRow = (ListRow) mRowsAdapter.get(i); ArrayObjectAdapter objectAdapter = (ArrayObjectAdapter) tempListRow.getAdapter(); objectAdapter.setItems(tempMap.get(group), getCallback()); } i++; } } }
Example #9
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 #10
Source File: BrowseFolderFragment.java From jellyfin-androidtv with GNU General Public License v2.0 | 6 votes |
@Override protected void addAdditionalRows(ArrayObjectAdapter rowAdapter) { super.addAdditionalRows(rowAdapter); if (showViews) { HeaderItem gridHeader = new HeaderItem(rowAdapter.size(), mApplication.getString(R.string.lbl_views)); GridButtonPresenter mGridPresenter = new GridButtonPresenter(); ArrayObjectAdapter gridRowAdapter = new ArrayObjectAdapter(mGridPresenter); gridRowAdapter.add(new GridButton(BY_LETTER, mApplication.getString(R.string.lbl_by_letter), R.drawable.tile_letters)); if (itemTypeString != null && itemTypeString.equals("Movie")) gridRowAdapter.add(new GridButton(SUGGESTED, mApplication.getString(R.string.lbl_suggested), R.drawable.tile_suggestions)); gridRowAdapter.add(new GridButton(GENRES, mApplication.getString(R.string.lbl_genres), R.drawable.tile_genres)); gridRowAdapter.add(new GridButton(PERSONS, mApplication.getString(R.string.lbl_performers), R.drawable.tile_actors)); rowAdapter.add(new ListRow(gridHeader, gridRowAdapter)); } }
Example #11
Source File: StdBrowseFragment.java From jellyfin-androidtv with GNU General Public License v2.0 | 6 votes |
protected void refreshRows() { new Handler().postDelayed(new Runnable() { @Override public void run() { if (mActivity.isFinishing()) return; for (int i = 0; i < mRowsAdapter.size(); i++) { if (mRowsAdapter.get(i) instanceof ListRow) { if (((ListRow) mRowsAdapter.get(i)).getAdapter() instanceof ItemRowAdapter && !mActivity.isFinishing()) { ((ItemRowAdapter) ((ListRow) mRowsAdapter.get(i)).getAdapter()).ReRetrieveIfNeeded(); } } } } },1500); }
Example #12
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 #13
Source File: EnhancedBrowseFragment.java From jellyfin-androidtv with GNU General Public License v2.0 | 6 votes |
protected void addAdditionalRows(ArrayObjectAdapter rowAdapter) { if (showViews) { HeaderItem gridHeader = new HeaderItem(rowAdapter.size(), mApplication.getString(R.string.lbl_views)); GridButtonPresenter mGridPresenter = new GridButtonPresenter(); ArrayObjectAdapter gridRowAdapter = new ArrayObjectAdapter(mGridPresenter); switch (itemTypeString) { case "Movie": gridRowAdapter.add(new GridButton(SUGGESTED, mApplication.getString(R.string.lbl_suggested), R.drawable.tile_suggestions)); addStandardViewButtons(gridRowAdapter); break; case "MusicAlbum": gridRowAdapter.add(new GridButton(ALBUMS, TvApp.getApplication().getString(R.string.lbl_albums), R.drawable.tile_audio)); gridRowAdapter.add(new GridButton(ARTISTS, TvApp.getApplication().getString(R.string.lbl_artists), R.drawable.tile_artists)); gridRowAdapter.add(new GridButton(GENRES, mApplication.getString(R.string.lbl_genres), R.drawable.tile_genres)); gridRowAdapter.add(new GridButton(SEARCH, mApplication.getString(R.string.lbl_search), R.drawable.tile_search)); break; default: addStandardViewButtons(gridRowAdapter); break; } rowAdapter.add(new ListRow(gridHeader, gridRowAdapter)); } }
Example #14
Source File: CustomBrowseFragment.java From jellyfin-androidtv with GNU General Public License v2.0 | 6 votes |
@Override public void onItemSelected(Presenter.ViewHolder itemViewHolder, Object item, RowPresenter.ViewHolder rowViewHolder, Row row) { if (!(item instanceof BaseRowItem)) { //fill in default background mBackgroundUrl = null; startBackgroundTimer(); return; } BaseRowItem rowItem = (BaseRowItem) item; mCurrentItem = rowItem; mCurrentRow = (ListRow) row; //mApplication.getLogger().Debug("Selected Item "+rowItem.getIndex() + " type: "+ (rowItem.getItemType().equals(BaseRowItem.ItemType.BaseItem) ? rowItem.getBaseItem().getType() : "other")); ItemRowAdapter adapter = (ItemRowAdapter) ((ListRow)row).getAdapter(); adapter.loadMoreItemsIfNeeded(rowItem.getIndex()); mBackgroundUrl = rowItem.getBackdropImageUrl(); startBackgroundTimer(); }
Example #15
Source File: SearchFragment.java From androidtv-Leanback with Apache License 2.0 | 6 votes |
@Override public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) { int titleRes; if (cursor != null && cursor.moveToFirst()) { mResultsFound = true; titleRes = R.string.search_results; } else { mResultsFound = false; titleRes = R.string.no_search_results; } mVideoCursorAdapter.changeCursor(cursor); HeaderItem header = new HeaderItem(getString(titleRes, mQuery)); mRowsAdapter.clear(); ListRow row = new ListRow(header, mVideoCursorAdapter); mRowsAdapter.add(row); }
Example #16
Source File: TextSearchFragment.java From jellyfin-androidtv with GNU General Public License v2.0 | 6 votes |
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); // Add event listeners EditText searchBar = getActivity().findViewById(R.id.search_bar); searchBar.addTextChangedListener(this); searchBar.setOnEditorActionListener(this); // Set up result fragment RowsSupportFragment rowsSupportFragment = (RowsSupportFragment) getChildFragmentManager().findFragmentById(R.id.results_frame); rowsSupportFragment.setAdapter(searchProvider.getResultsAdapter()); // Create click listener rowsSupportFragment.setOnItemViewClickedListener((itemViewHolder, item, rowViewHolder, row) -> { if (!(item instanceof BaseRowItem)) return; ItemLauncher.launch((BaseRowItem) item, (ItemRowAdapter) ((ListRow) row).getAdapter(), ((BaseRowItem) item).getIndex(), getActivity()); }); }
Example #17
Source File: EnhancedBrowseFragment.java From jellyfin-androidtv with GNU General Public License v2.0 | 5 votes |
@Override public void onItemSelected(Presenter.ViewHolder itemViewHolder, Object item, RowPresenter.ViewHolder rowViewHolder, Row row) { mHandler.removeCallbacks(updateContentTask); if (item instanceof GridButton && ((GridButton)item).getId() == FAVSONGS) { //set to specialized item mCurrentItem = favSongsRowItem; } if (!(item instanceof BaseRowItem)) { mTitle.setText(mFolder != null ? mFolder.getName() : ""); mInfoRow.removeAllViews(); mSummary.setText(""); //fill in default background mBackgroundUrl = null; startBackgroundTimer(); return; } BaseRowItem rowItem = (BaseRowItem) item; mCurrentItem = rowItem; mCurrentRow = (ListRow) row; mTitle.setText(mCurrentItem.getName()); mInfoRow.removeAllViews(); mSummary.setText(""); mHandler.postDelayed(updateContentTask, 500); //mApplication.getLogger().Debug("Selected Item "+rowItem.getIndex() + " type: "+ (rowItem.getItemType().equals(BaseRowItem.ItemType.BaseItem) ? rowItem.getBaseItem().getType() : "other")); ItemRowAdapter adapter = (ItemRowAdapter) ((ListRow)row).getAdapter(); adapter.loadMoreItemsIfNeeded(rowItem.getIndex()); if (ShowFanart) { mBackgroundUrl = rowItem.getBackdropImageUrl(); startBackgroundTimer(); } }
Example #18
Source File: StdBrowseFragment.java From jellyfin-androidtv with GNU General Public License v2.0 | 5 votes |
@Override public void onItemSelected(Presenter.ViewHolder itemViewHolder, Object item, RowPresenter.ViewHolder rowViewHolder, Row row) { if (!(item instanceof BaseRowItem)) { mCurrentItem = null; //fill in default background mBackgroundUrl = null; startBackgroundTimer(); return; } else { mCurrentItem = (BaseRowItem)item; } mCurrentRow = (ListRow) row; BaseRowItem rowItem = (BaseRowItem) item; if (((ListRow) row).getAdapter() instanceof ItemRowAdapter) { //mApplication.getLogger().Debug("Selected Item "+rowItem.getIndex() + " type: "+ (rowItem.getItemType().equals(BaseRowItem.ItemType.BaseItem) ? rowItem.getBaseItem().getType() : "other")); ItemRowAdapter adapter = (ItemRowAdapter) ((ListRow) row).getAdapter(); adapter.loadMoreItemsIfNeeded(rowItem.getIndex()); } if (ShowFanart) { mBackgroundUrl = rowItem.getBackdropImageUrl(); startBackgroundTimer(); } }
Example #19
Source File: EnhancedBrowseFragment.java From jellyfin-androidtv with GNU General Public License v2.0 | 5 votes |
@Override public void onItemClicked(final Presenter.ViewHolder itemViewHolder, Object item, RowPresenter.ViewHolder rowViewHolder, Row row) { if (!(item instanceof BaseRowItem)) return; MediaManager.setCurrentMediaTitle(row.getHeaderItem().getName()); ItemLauncher.launch((BaseRowItem) item, (ItemRowAdapter) ((ListRow)row).getAdapter(), ((BaseRowItem)item).getIndex(), getActivity()); }
Example #20
Source File: EnhancedBrowseFragment.java From jellyfin-androidtv with GNU General Public License v2.0 | 5 votes |
private void refreshCurrentItem() { if (mCurrentItem != null && mCurrentItem.getBaseItemType() != BaseItemType.Photo && mCurrentItem.getBaseItemType() != BaseItemType.MusicArtist && mCurrentItem.getBaseItemType() != BaseItemType.MusicAlbum && mCurrentItem.getBaseItemType() != BaseItemType.Playlist) { mCurrentItem.refresh(new EmptyResponse() { @Override public void onResponse() { ItemRowAdapter adapter = (ItemRowAdapter) ((ListRow) mCurrentRow).getAdapter(); adapter.notifyArrayItemRangeChanged(adapter.indexOf(mCurrentItem), 1); } }); } }
Example #21
Source File: EnhancedBrowseFragment.java From jellyfin-androidtv with GNU General Public License v2.0 | 5 votes |
@Override public void onResume() { super.onResume(); ShowFanart = mApplication.getUserPreferences().get(UserPreferences.Companion.getBackdropEnabled()); //React to deletion if (getActivity() != null && !getActivity().isFinishing() && mCurrentRow != null && mCurrentItem != null && mCurrentItem.getItemId() != null && mCurrentItem.getItemId().equals(TvApp.getApplication().dataRefreshService.getLastDeletedItemId())) { ((ItemRowAdapter)mCurrentRow.getAdapter()).remove(mCurrentItem); TvApp.getApplication().dataRefreshService.setLastDeletedItemId(null); } if (!justLoaded) { //Re-retrieve anything that needs it but delay slightly so we don't take away gui landing if (mRowsAdapter != null) { refreshCurrentItem(); new Handler().postDelayed(new Runnable() { @Override public void run() { if (mActivity.isFinishing()) return; for (int i = 0; i < mRowsAdapter.size(); i++) { if (mRowsAdapter.get(i) instanceof ListRow) { if (((ListRow) mRowsAdapter.get(i)).getAdapter() instanceof ItemRowAdapter && !mActivity.isFinishing()) { ((ItemRowAdapter) ((ListRow) mRowsAdapter.get(i)).getAdapter()).ReRetrieveIfNeeded(); } } } } }, 1500); } } else { justLoaded = false; } }
Example #22
Source File: StdBrowseFragment.java From jellyfin-androidtv with GNU General Public License v2.0 | 5 votes |
private void refreshCurrentItem() { if (mCurrentItem != null && mCurrentItem.getBaseItemType() != BaseItemType.UserView && mCurrentItem.getBaseItemType() != BaseItemType.CollectionFolder) { Timber.d("Refresh item \"%s\"", mCurrentItem.getFullName()); mCurrentItem.refresh(new EmptyResponse() { @Override public void onResponse() { ItemRowAdapter adapter = (ItemRowAdapter) ((ListRow)mCurrentRow).getAdapter(); adapter.notifyArrayItemRangeChanged(adapter.indexOf(mCurrentItem), 1); } }); } }
Example #23
Source File: CustomBrowseFragment.java From jellyfin-androidtv with GNU General Public License v2.0 | 5 votes |
@Override public void onItemClicked(final Presenter.ViewHolder itemViewHolder, Object item, RowPresenter.ViewHolder rowViewHolder, Row row) { if (!(item instanceof BaseRowItem)) return; ItemLauncher.launch((BaseRowItem) item, (ItemRowAdapter) ((ListRow)row).getAdapter(), ((BaseRowItem) item).getIndex(), getActivity()); }
Example #24
Source File: FullDetailsActivity.java From jellyfin-androidtv with GNU General Public License v2.0 | 5 votes |
protected void addItemRow(ArrayObjectAdapter parent, ItemRowAdapter row, int index, String headerText) { HeaderItem header = new HeaderItem(index, headerText); ListRow listRow = new ListRow(header, row); parent.add(listRow); row.setRow(listRow); row.Retrieve(); }
Example #25
Source File: FullDetailsActivity.java From jellyfin-androidtv with GNU General Public License v2.0 | 5 votes |
@Override public void onItemClicked(final Presenter.ViewHolder itemViewHolder, Object item, RowPresenter.ViewHolder rowViewHolder, Row row) { if (!(item instanceof BaseRowItem)) return; ItemLauncher.launch((BaseRowItem) item, (ItemRowAdapter) ((ListRow)row).getAdapter(), ((BaseRowItem)item).getIndex(), mActivity); }
Example #26
Source File: TvManager.java From jellyfin-androidtv with GNU General Public License v2.0 | 5 votes |
private static void addRow(List<BaseItemDto> timers, Presenter presenter, ArrayObjectAdapter rowAdapter) { ItemRowAdapter scheduledAdapter = new ItemRowAdapter(timers, presenter, rowAdapter, true); scheduledAdapter.Retrieve(); ListRow scheduleRow = new ListRow(new HeaderItem(TimeUtils.getFriendlyDate(TimeUtils.convertToLocalDate(timers.get(0).getStartDate()), true)), scheduledAdapter); rowAdapter.add(scheduleRow); }
Example #27
Source File: VodTvSectionFragment.java From xipl with Apache License 2.0 | 5 votes |
/** * Adds a new {@link ArrayObjectAdapter} for a new VOD content category * * @param tempMap the map used to retrieve contents * @param group the name of the VOD content group */ private void addContentRow(Map<String, List<AvContent>> tempMap, String group) { if (mRowsAdapter != null) { ArrayObjectAdapter arrayObjectAdapter = new ArrayObjectAdapter(new CardViewPresenter(getImageProcessor())); HeaderItem header = new HeaderItem(group); arrayObjectAdapter.addAll(0, tempMap.get(group)); mRowsAdapter.add(new ListRow(header, arrayObjectAdapter)); } }
Example #28
Source File: ProviderSearchFragment.java From xipl with Apache License 2.0 | 5 votes |
@Override public void onPostExecute(List<ListRow> results) { if (!results.isEmpty()) { removeNoResultsView(); mRowsAdapter.addAll(0, results); } else if (mEmptyResultsView.getParent() == null) { // Show only the no results view if it has a parent. showNoResultsView(); } }
Example #29
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 #30
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); }