Java Code Examples for androidx.leanback.widget.ArrayObjectAdapter#add()
The following examples show how to use
androidx.leanback.widget.ArrayObjectAdapter#add() .
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: CardExampleFragment.java From tv-samples with Apache License 2.0 | 6 votes |
private Row createCardRow(final CardRow cardRow) { switch (cardRow.getType()) { case CardRow.TYPE_SECTION_HEADER: return new SectionRow(new HeaderItem(cardRow.getTitle())); case CardRow.TYPE_DIVIDER: return new DividerRow(); case CardRow.TYPE_DEFAULT: default: // Build main row using the ImageCardViewPresenter. PresenterSelector presenterSelector = new CardPresenterSelector(getActivity()); ArrayObjectAdapter listRowAdapter = new ArrayObjectAdapter(presenterSelector); for (Card card : cardRow.getCards()) { listRowAdapter.add(card); } return new CardListRow(new HeaderItem(cardRow.getTitle()), listRowAdapter, cardRow); } }
Example 2
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 3
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 4
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 5
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 6
Source File: MediaPlayerGlue.java From tv-samples with Apache License 2.0 | 5 votes |
@Override protected void onCreateSecondaryActions(ArrayObjectAdapter secondaryActionsAdapter) { // Instantiate secondary actions secondaryActionsAdapter.add(mShuffleAction); secondaryActionsAdapter.add(mRepeatAction); secondaryActionsAdapter.add(mThumbsDownAction); secondaryActionsAdapter.add(mThumbsUpAction); }
Example 7
Source File: PageAndListRowFragment.java From tv-samples with Apache License 2.0 | 5 votes |
private ListRow createCardRow(CardRow cardRow) { SettingsIconPresenter iconCardPresenter = new SettingsIconPresenter(getActivity()); ArrayObjectAdapter adapter = new ArrayObjectAdapter(iconCardPresenter); for(Card card : cardRow.getCards()) { adapter.add(card); } HeaderItem headerItem = new HeaderItem(cardRow.getTitle()); return new CardListRow(headerItem, adapter, cardRow); }
Example 8
Source File: DetailViewExampleWithVideoBackgroundFragment.java From tv-samples with Apache License 2.0 | 5 votes |
@Override public void onActivityResult(int requestCode, int resultCode, Intent returnIntent) { if (requestCode == DetailViewExampleWithVideoBackgroundActivity.BUY_MOVIE_REQUEST) { if (resultCode == Activity.RESULT_OK) { ArrayObjectAdapter actionAdapter = (ArrayObjectAdapter) ((DetailsOverviewRow) getAdapter().get(0)).getActionsAdapter(); actionAdapter.add(0, mActionPlay); actionAdapter.remove(mActionRent); setTitle(getTitle() + " (Owned)"); boolean watchNow = returnIntent .getBooleanExtra(WizardExampleActivity.WATCH_NOW, false); if (watchNow) { // Leave a delay for playing the video in order to focus on the video fragment // after coming back from Wizard activity new Handler().postDelayed(new Runnable() { @Override public void run() { playMainVideoOnBackground(); } }, 500); } } } }
Example 9
Source File: VideoPlayerGlue.java From tv-samples with Apache License 2.0 | 5 votes |
@Override protected void onCreatePrimaryActions(ArrayObjectAdapter adapter) { // Order matters, super.onCreatePrimaryActions() will create the play / pause action. // Will display as follows: // play/pause, previous, rewind, fast forward, next // > /|| |< << >> >| super.onCreatePrimaryActions(adapter); adapter.add(mSkipPreviousAction); adapter.add(mRewindAction); adapter.add(mFastForwardAction); adapter.add(mSkipNextAction); }
Example 10
Source File: VideoPlayerGlue.java From tv-samples with Apache License 2.0 | 5 votes |
@Override protected void onCreateSecondaryActions(ArrayObjectAdapter adapter) { super.onCreateSecondaryActions(adapter); adapter.add(mThumbsDownAction); adapter.add(mThumbsUpAction); adapter.add(mRepeatAction); }
Example 11
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 12
Source File: VideoPlayerGlue.java From androidtv-Leanback with Apache License 2.0 | 5 votes |
@Override protected void onCreatePrimaryActions(ArrayObjectAdapter adapter) { // Order matters, super.onCreatePrimaryActions() will create the play / pause action. // Will display as follows: // play/pause, previous, rewind, fast forward, next // > /|| |< << >> >| super.onCreatePrimaryActions(adapter); adapter.add(mSkipPreviousAction); adapter.add(mRewindAction); adapter.add(mFastForwardAction); adapter.add(mSkipNextAction); }
Example 13
Source File: HomeFragmentFooterRow.java From jellyfin-androidtv with GNU General Public License v2.0 | 5 votes |
@Override public void addToRowsAdapter(CardPresenter cardPresenter, ArrayObjectAdapter rowsAdapter) { HeaderItem header = new HeaderItem(rowsAdapter.size(), activity.getString(R.string.lbl_settings)); GridButtonPresenter presenter = new GridButtonPresenter(); ArrayObjectAdapter adapter = new ArrayObjectAdapter(presenter); adapter.add(new GridButton(SETTINGS, activity.getString(R.string.lbl_settings), R.drawable.tile_settings)); adapter.add(new GridButton(LOGOUT, activity.getString(R.string.lbl_logout), R.drawable.tile_logout)); rowsAdapter.add(new ListRow(header, adapter)); }
Example 14
Source File: AdapterModule.java From tv-samples with Apache License 2.0 | 5 votes |
@DetailFragmentArrayObjectAdapterForRowsQualifier @PerFragment @Provides ArrayObjectAdapter provideRowsArrayObjectAdapter(DetailsOverviewRow detailsOverviewRow, ListRow relatedRow, PresenterSelector mps) { ArrayObjectAdapter rowsAdapter = new ArrayObjectAdapter(mps); rowsAdapter.add(detailsOverviewRow); rowsAdapter.add(relatedRow); return rowsAdapter; }
Example 15
Source File: BrowseRecordingsFragment.java From jellyfin-androidtv with GNU General Public License v2.0 | 5 votes |
@Override protected void addAdditionalRows(ArrayObjectAdapter rowAdapter) { 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(SCHEDULE, TvApp.getApplication().getString(R.string.lbl_schedule), R.drawable.tile_port_time)); gridRowAdapter.add(new GridButton(SERIES, mActivity.getString(R.string.lbl_series_recordings), R.drawable.tile_port_series_timer)); rowAdapter.add(new ListRow(gridHeader, gridRowAdapter)); }
Example 16
Source File: MainFragment.java From tv-samples with Apache License 2.0 | 5 votes |
private ListRow createCardRow(CardRow cardRow) { PresenterSelector presenterSelector = new CardPresenterSelector(getActivity()); ArrayObjectAdapter listRowAdapter = new ArrayObjectAdapter(presenterSelector); for (Card card : cardRow.getCards()) { listRowAdapter.add(card); } return new ListRow(listRowAdapter); }
Example 17
Source File: VideoMediaPlayerGlue.java From tv-samples with Apache License 2.0 | 4 votes |
@Override protected void onCreatePrimaryActions(ArrayObjectAdapter adapter) { super.onCreatePrimaryActions(adapter); adapter.add(mRepeatAction); adapter.add(mClosedCaptioningAction); }
Example 18
Source File: CustomBrowseFragment.java From jellyfin-androidtv with GNU General Public License v2.0 | 4 votes |
public void loadRows(List<BrowseRowDef> rows) { mRowsAdapter = new ArrayObjectAdapter(new PositionableListRowPresenter()); mCardPresenter = new CardPresenter(); for (BrowseRowDef def : rows) { HeaderItem header = new HeaderItem(def.getHeaderText()); ItemRowAdapter rowAdapter; switch (def.getQueryType()) { case NextUp: rowAdapter = new ItemRowAdapter(def.getNextUpQuery(), true, mCardPresenter, mRowsAdapter); break; case Season: rowAdapter = new ItemRowAdapter(def.getSeasonQuery(), mCardPresenter, mRowsAdapter); break; case Upcoming: rowAdapter = new ItemRowAdapter(def.getUpcomingQuery(), mCardPresenter, mRowsAdapter); break; case Views: rowAdapter = new ItemRowAdapter(new ViewQuery(), mCardPresenter, mRowsAdapter); break; case SimilarSeries: rowAdapter = new ItemRowAdapter(def.getSimilarQuery(), QueryType.SimilarSeries, mCardPresenter, mRowsAdapter); break; case SimilarMovies: rowAdapter = new ItemRowAdapter(def.getSimilarQuery(), QueryType.SimilarMovies, mCardPresenter, mRowsAdapter); break; case Persons: rowAdapter = new ItemRowAdapter(def.getPersonsQuery(), def.getChunkSize(), mCardPresenter, mRowsAdapter); break; case LiveTvChannel: rowAdapter = new ItemRowAdapter(def.getTvChannelQuery(), 40, mCardPresenter, mRowsAdapter); break; case LiveTvProgram: rowAdapter = new ItemRowAdapter(def.getProgramQuery(), mCardPresenter, mRowsAdapter); break; case LiveTvRecording: rowAdapter = new ItemRowAdapter(def.getRecordingQuery(), def.getChunkSize(), mCardPresenter, mRowsAdapter); break; default: rowAdapter = new ItemRowAdapter(def.getQuery(), def.getChunkSize(), def.getPreferParentThumb(), def.isStaticHeight(), mCardPresenter, mRowsAdapter); break; } rowAdapter.setReRetrieveTriggers(def.getChangeTriggers()); ListRow row = new ListRow(header, rowAdapter); mRowsAdapter.add(row); rowAdapter.setRow(row); rowAdapter.Retrieve(); } addAdditionalRows(mRowsAdapter); mRowsFragment.setAdapter(mRowsAdapter); }
Example 19
Source File: PhotoPlayerActivity.java From jellyfin-androidtv with GNU General Public License v2.0 | 4 votes |
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_photo_player); mainImages[0] = (KenBurnsView) findViewById(R.id.mainImage); mainImages[1] = (KenBurnsView) findViewById(R.id.mainImage2); nextImage = new ImageView(this); nextImage.setScaleType(ImageView.ScaleType.CENTER_INSIDE); prevImage = new ImageView(this); prevImage.setScaleType(ImageView.ScaleType.CENTER_INSIDE); displayWidth = getResources().getDisplayMetrics().widthPixels; displayHeight = getResources().getDisplayMetrics().heightPixels; mPopupArea = (FrameLayout) findViewById(R.id.popupArea); handler = new Handler(); currentImageView().setTransitionGenerator(new MyRandomeKBGenerator(9000, new AccelerateDecelerateInterpolator())); nextImageView().setTransitionGenerator(new MyRandomeKBGenerator(9000, new AccelerateDecelerateInterpolator())); currentImageView().pause(); nextImageView().pause(); currentPhoto = MediaManager.getCurrentMediaItem().getBaseItem(); loadImage(currentPhoto, currentImageView(), getIntent().getBooleanExtra("Play", false)); loadImage(currentPhoto, nextImageView()); loadNext(); loadPrev(); // Inject the RowsSupportFragment in the popup container if (getFragmentManager().findFragmentById(R.id.rows_area) == null) { mPopupRowsFragment = new RowsSupportFragment(); getSupportFragmentManager().beginTransaction() .replace(R.id.rows_area, mPopupRowsFragment).commit(); } else { mPopupRowsFragment = (RowsSupportFragment) getSupportFragmentManager() .findFragmentById(R.id.rows_area); } mPopupRowPresenter = new PositionableListRowPresenter(); mPopupRowAdapter = new ArrayObjectAdapter(mPopupRowPresenter); mPopupRowsFragment.setAdapter(mPopupRowAdapter); mThumbRow = new ListRow(new HeaderItem(""), MediaManager.getCurrentMediaAdapter()); mPopupRowAdapter.add(mThumbRow); mPopupRowsFragment.setOnItemViewClickedListener(itemViewClickedListener); mPopupRowsFragment.setOnItemViewSelectedListener(itemViewSelectedListener); setupPopupAnimations(); }
Example 20
Source File: StdBrowseFragment.java From jellyfin-androidtv with GNU General Public License v2.0 | 4 votes |
public void loadRows(List<BrowseRowDef> rows) { mRowsAdapter = new ArrayObjectAdapter(new PositionableListRowPresenter()); mCardPresenter = new CardPresenter(); for (BrowseRowDef def : rows) { HeaderItem header = new HeaderItem(def.getHeaderText()); ItemRowAdapter rowAdapter; switch (def.getQueryType()) { case NextUp: rowAdapter = new ItemRowAdapter(def.getNextUpQuery(), true, mCardPresenter, mRowsAdapter); break; case LatestItems: rowAdapter = new ItemRowAdapter(def.getLatestItemsQuery(), true, mCardPresenter, mRowsAdapter); break; case Season: rowAdapter = new ItemRowAdapter(def.getSeasonQuery(), mCardPresenter, mRowsAdapter); break; case Upcoming: rowAdapter = new ItemRowAdapter(def.getUpcomingQuery(), mCardPresenter, mRowsAdapter); break; case Views: rowAdapter = new ItemRowAdapter(new ViewQuery(), mCardPresenter, mRowsAdapter); break; case SimilarSeries: rowAdapter = new ItemRowAdapter(def.getSimilarQuery(), QueryType.SimilarSeries, mCardPresenter, mRowsAdapter); break; case SimilarMovies: rowAdapter = new ItemRowAdapter(def.getSimilarQuery(), QueryType.SimilarMovies, mCardPresenter, mRowsAdapter); break; case Persons: rowAdapter = new ItemRowAdapter(def.getPersonsQuery(), def.getChunkSize(), mCardPresenter, mRowsAdapter); break; case LiveTvChannel: rowAdapter = new ItemRowAdapter(def.getTvChannelQuery(), 40, mCardPresenter, mRowsAdapter); break; case LiveTvProgram: rowAdapter = new ItemRowAdapter(def.getProgramQuery(), mCardPresenter, mRowsAdapter); break; case LiveTvRecording: rowAdapter = new ItemRowAdapter(def.getRecordingQuery(), def.getChunkSize(), mCardPresenter, mRowsAdapter); break; case LiveTvRecordingGroup: rowAdapter = new ItemRowAdapter(def.getRecordingGroupQuery(), mCardPresenter, mRowsAdapter); break; default: rowAdapter = new ItemRowAdapter(def.getQuery(), def.getChunkSize(), def.getPreferParentThumb(), def.isStaticHeight(), mCardPresenter, mRowsAdapter, def.getQueryType()); break; } rowAdapter.setReRetrieveTriggers(def.getChangeTriggers()); ListRow row = new ListRow(header, rowAdapter); mRowsAdapter.add(row); rowAdapter.setRow(row); rowAdapter.Retrieve(); } addAdditionalRows(mRowsAdapter); setAdapter(mRowsAdapter); }