private Row getRelatedItems() { ArrayObjectAdapter listRowAdapter = new ArrayObjectAdapter(new CardPresenter()); final Set<Long> related = mSelectedEvent.getMetadata().getRelated().keySet(); mDisposables.add(((LeanbackBaseActivity) getActivity()).getApiServiceObservable() .observeOn(AndroidSchedulers.mainThread()) .subscribe( mediaApiService -> { for (long id : related) { mDisposables.add(mediaApiService.getEvent(id) .observeOn(AndroidSchedulers.mainThread()) .subscribe(event -> listRowAdapter.add(event))); } listRowAdapter.notifyArrayItemRangeChanged(0, listRowAdapter.size()); } ) ); HeaderItem header = new HeaderItem(0, getString(R.string.related_talks)); return new ListRow(header, listRowAdapter); }
private void setupUI() { VideoFragment videoFragment = (VideoFragment) getFragmentManager().findFragmentById(R.id.video_fragment); mGlue = new VideoFragmentGlueHost(videoFragment); mGlue.setSurfaceHolderCallback(this); mGlue.setOnActionClickedListener(this); mControlsRow = new PlaybackControlsRow(mSelectedLink); ArrayObjectAdapter adapter = new ArrayObjectAdapter(new ControlButtonPresenterSelector()); mPlayPauseAction = new PlaybackControlsRow.PlayPauseAction(this); mPlayPauseAction.nextIndex(); // set to play adapter.add(new PlaybackControlsRow.RewindAction(this)); adapter.add(mPlayPauseAction); adapter.add(new PlaybackControlsRow.FastForwardAction(this)); mControlsRow.setPrimaryActionsAdapter(adapter); PlaybackControlsRowPresenter presenter = new PlaybackControlsRowPresenter(new DetailsPresenter()); mGlue.setPlaybackRow(mControlsRow); mGlue.setPlaybackRowPresenter(presenter); }
@Override public void onCreate(Bundle savedInstanceState) { Log.d(TAG, "onCreate DetailsFragment"); super.onCreate(savedInstanceState); mDetailsBackground = new DetailsFragmentBackgroundController(this); mSelectedMovie = (Movie) getActivity().getIntent().getSerializableExtra(DetailsActivity.MOVIE); if (mSelectedMovie != null) { mPresenterSelector = new ClassPresenterSelector(); mAdapter = new ArrayObjectAdapter(mPresenterSelector); setupDetailsOverviewRow(); setupDetailsOverviewRowPresenter(); setupRelatedMovieListRow(); setAdapter(mAdapter); initializeBackground(mSelectedMovie); setOnItemViewClickedListener(new ItemViewClickedListener()); } else { Intent intent = new Intent(getActivity(), MainActivity.class); startActivity(intent); } }
@Override public PlaybackControlsRowPresenter createControlsRowAndPresenter() { PlaybackControlsRowPresenter presenter = super.createControlsRowAndPresenter(); adapter = new ArrayObjectAdapter(new ControlButtonPresenterSelector()); getControlsRow().setSecondaryActionsAdapter(adapter); mFastForwardAction = (PlaybackControlsRow.FastForwardAction) getPrimaryActionsAdapter() .lookup(ACTION_FAST_FORWARD); mRewindAction = (PlaybackControlsRow.RewindAction) getPrimaryActionsAdapter() .lookup(ACTION_REWIND); presenter.setOnActionClickedListener(new OnActionClickedListener() { @Override public void onActionClicked(Action action) { dispatchAction(action); } }); return presenter; }
@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(); }
private Row getRelatedItems() { ArrayObjectAdapter listRowAdapter = new ArrayObjectAdapter(new CardPresenter()); final long[] related = mSelectedEvent.getMetadata().getRelated(); mDisposables.add(((LeanbackBaseActivity) getActivity()).getApiServiceObservable() .observeOn(AndroidSchedulers.mainThread()) .subscribe( mediaApiService -> { for (long id : related) { mDisposables.add(mediaApiService.getEvent(id) .observeOn(AndroidSchedulers.mainThread()) .subscribe(event -> listRowAdapter.add(event))); } listRowAdapter.notifyArrayItemRangeChanged(0, listRowAdapter.size()); } ) ); HeaderItem header = new HeaderItem(0, getString(R.string.related_talks)); return new ListRow(header, listRowAdapter); }
private ArrayObjectAdapter getRecordingActionsAdapter(List<Recording> recordings) { ArrayObjectAdapter actionsAdapter = new ArrayObjectAdapter(); if(mWatchlistItem != null){ actionsAdapter.add(new Action(REMOVE_WATCHLIST_ACTION,getString(R.string.remove_from_watchlist))); } else { actionsAdapter.add(new Action(ADD_WATCHLIST_ACTION,getString(R.string.add_to_watchlist))); } if (recordings != null) { for (int i = 0; i < recordings.size(); i++) { Recording recording = recordings.get(i); if (recording.getMimeType().startsWith("video/") || true) { String quality = recording.isHighQuality() ? "HD" : "SD"; String title = quality + " (" + recording.getLanguage() + ")"; actionsAdapter.add(new Action(recording.getApiID(), title, recording.getMimeType().substring(6))); } } } else { actionsAdapter.add(new Action(DUMMY_ID, "Dummy", "HLS")); } return actionsAdapter; }
private void addStreams(CardPresenter cardPresenter, List<LiveConference> liveConferences) { if (liveConferences.size() > 0) { HeaderItem streamingHeader = new HeaderItem(getString(R.string.livestreams)); mStreamingSection = new SectionRow(streamingHeader); mRowsAdapter.add(0, mStreamingSection); for (LiveConference con : liveConferences) { if(!con.getConference().equals("Sendeschleife")){ int i = -1; for (i = 0; i < con.getGroups().size(); i++) { Group g = con.getGroups().get(i); // setup header String group = g.getGroup().length() > 0 ? g.getGroup() : con.getConference(); HeaderItem header = new HeaderItem(group); header.setDescription(con.getConference() + " - " + con.getDescription()); header.setContentDescription(group); // setup list ArrayObjectAdapter listRowAdapter = new ArrayObjectAdapter(cardPresenter); listRowAdapter.addAll(listRowAdapter.size(), g.getRooms()); mRowsAdapter.add(i + 1, new ListRow(header, listRowAdapter)); } } // mRowsAdapter.add(i + 1, new DividerRow()); } } }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); BackgroundManager bgMngr = BackgroundManager.getInstance(getActivity()); bgMngr.attach(getActivity().getWindow()); bgMngr.setColor(getResources().getColor(R.color.leanback_background)); mShortcut = (Shortcut)getActivity().getIntent().getSerializableExtra(EXTRA_SHORTCUT); DetailsOverviewRow detailRow = new DetailsOverviewRow(mShortcut); detailRow.setImageScaleUpAllowed(false); addActions(detailRow); mDetailsRowPresenter = new FullWidthDetailsOverviewRowPresenter(new ShortcutDetailsPresenter()); mDetailsRowPresenter.setBackgroundColor(getResources().getColor(R.color.lightblue900)); mDetailsRowPresenter.setOnActionClickedListener(this); ArrayObjectAdapter adapter = new ArrayObjectAdapter(mDetailsRowPresenter); adapter.add(detailRow); setAdapter(adapter); }
@Override protected void onPostExecute(Void avoid) { ClassPresenterSelector ps = new ClassPresenterSelector(); ps.addClassPresenter(DetailsOverviewRow.class, mOverviewRowPresenter); ps.addClassPresenter(PlotAndGenresRow.class, new PlotAndGenresRowPresenter(16,mColor)); // 16 lines max to fit on screen ps.addClassPresenter(FullTextRow.class, new FullTextRowPresenter(18,mColor)); // 18 lines max to fit on screen ps.addClassPresenter(ListRow.class, new ListRowPresenter()); mOverviewRowPresenter.setBackgroundColor(mColor); mRowsAdapter = new ArrayObjectAdapter(ps); mRowsAdapter.clear(); // Add all the non-null rows for (Row row : new Row[] {mDetailsRow, mPlotAndGenresRow, mCastRow, mPostersRow, mBackdropsRow, mWebLinksRow}) { if (row!=null) { mRowsAdapter.add(row); } } setAdapter(mRowsAdapter); }
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); prepareBackgroundManager(); setupUIElements(); setupEventListeners(); prepareEntranceTransition(); mCategoryRowAdapter = new ArrayObjectAdapter(new ListRowPresenter()); loadRows(); setAdapter(mCategoryRowAdapter); updateRecommendations(); }
private void setupRowAdapter() { VerticalGridPresenter gridPresenter = new VerticalGridPresenter(ZOOM_FACTOR); gridPresenter.setNumberOfColumns(COLUMNS); setGridPresenter(gridPresenter); PresenterSelector cardPresenterSelector = new CardPresenterSelector(getActivity()); mAdapter = new ArrayObjectAdapter(cardPresenterSelector); setAdapter(mAdapter); prepareEntranceTransition(); new Handler().postDelayed(new Runnable() { @Override public void run() { createRows(); startEntranceTransition(); } }, 1000); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ArrayObjectAdapter mRowAdapter = new ArrayObjectAdapter(new VideoCardViewPresenter(getContext())); setAdapter(mRowAdapter); setTitle(getString(R.string.assistant_playback_videos)); setBadgeDrawable( getActivity().getResources().getDrawable(R.drawable.assistant_tv_banner, null)); VerticalGridPresenter gridPresenter = new VerticalGridPresenter(); gridPresenter.setNumberOfColumns(NUM_COLUMNS); setGridPresenter(gridPresenter); for (Movie movie : MockDatabase.getAllMovies()) { mRowAdapter.add(movie); } setOnItemViewClickedListener(new ItemViewClickedListener()); }
private void setupFragment() { VerticalGridPresenter gridPresenter = new VerticalGridPresenter(FocusHighlight.ZOOM_FACTOR_SMALL); gridPresenter.setNumberOfColumns(numColumns); //gridPresenter.setShadowEnabled(false); setGridPresenter(gridPresenter); mAdapter = new ArrayObjectAdapter(new CardPresenter()); List<Contact> contacts = ContactProvider.getContactList(); mAdapter.addAll(0, contacts); setAdapter(mAdapter); setOnItemViewClickedListener(new ItemViewClickedListener()); setOnItemViewSelectedListener(new ItemViewSelectedListener()); }
private void setupFragment() { VerticalGridPresenter gridPresenter = new VerticalGridPresenter(FocusHighlight.ZOOM_FACTOR_NONE); gridPresenter.setNumberOfColumns(numColumns); //gridPresenter.setShadowEnabled(false); setGridPresenter(gridPresenter); mAdapter = new ArrayObjectAdapter(new ContactPresenter()); List<Contact> contacts = ContactProvider.getContactList(); mAdapter.addAll(0, contacts); setAdapter(mAdapter); setOnItemViewClickedListener(new ItemViewClickedListener()); setOnItemViewSelectedListener(new ItemViewSelectedListener()); }
private ListRow getSeasonRow(String seasonNumber, boolean createNewRow) { seasonNumber = TextUtils.isEmpty(seasonNumber) ? "" : seasonNumber; ArrayObjectAdapter rowsAdaptor = getRowsAdapter(); for (int i = rowsAdaptor.size() - 1; i >= 0; i--) { Object row = rowsAdaptor.get(i); if (row instanceof ListRow) { int compareResult = BaseProgram.numberCompare(seasonNumber, ((SeasonRowAdapter) ((ListRow) row).getAdapter()).mSeasonNumber); if (compareResult == 0) { return (ListRow) row; } else if (compareResult < 0) { return createNewRow ? createNewSeasonRow(seasonNumber, i + 1) : null; } } } return createNewRow ? createNewSeasonRow(seasonNumber, rowsAdaptor.size()) : null; }
private void loadRows() { mRowsAdapter = new ArrayObjectAdapter(new ListRowPresenter()); mApkDownloadHelper = new ApkDownloadHelper(getActivity()); // Setup the package installer for the session mApkDownloadHelper.addListener(mDownloadListener); HeaderItem header = null; if (getResources().getBoolean(R.bool.ENABLE_APP_REPO)) { createRowApkDownloads(); } if (getResources().getBoolean(R.bool.ENABLE_DOWNLOADS_ROW)) { createRowDownloadedApks(); } createRowShortcutGenerator(); createRowCustomShortcuts(); createRowMisc(); setAdapter(mRowsAdapter); }
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); //setup background updater mBackgroundUpdater = new BackgroundUpdater(); mBackgroundUpdater.initialise(getActivity(), R.color.black); //setup main adapter ListRowPresenter mainMenuRowPresenter = new ListRowPresenter(); mainMenuRowPresenter.setShadowEnabled(false); mRowsAdapter = new ArrayObjectAdapter(mainMenuRowPresenter); setAdapter(mRowsAdapter); setupUIElements(); setupEventListeners(); setupAdapters(); loadData(); }
private void setupMoreMovies() { HeaderItem moreMoviesHeader = new HeaderItem(1, getString(R.string.more_movies)); MorePresenter morePresenter = new MorePresenter(getActivity()); ArrayObjectAdapter moreRowAdapter = new ArrayObjectAdapter(morePresenter); // add items List<MediaProvider.NavInfo> navigation = mMoviesProvider.getNavigation(); for (MediaProvider.NavInfo info : navigation) { moreRowAdapter.add(new MorePresenter.MoreItem( info.getId(), info.getLabel(), info.getIcon(), info)); } mRowsAdapter.add(new ListRow(moreMoviesHeader, moreRowAdapter)); }
private void setupPlaybackControlItemsToInitialisingState() { mRowsAdapter.clear(); mPlaybackControlsRow = new PlaybackControlsRow(mStreamInfo); mPlaybackControlsRow.setCurrentTime(0); mPlaybackControlsRow.setBufferedProgress(0); ControlButtonPresenterSelector presenterSelector = new ControlButtonPresenterSelector(); mPrimaryActionsAdapter = new ArrayObjectAdapter(presenterSelector); mPlaybackControlsRow.setPrimaryActionsAdapter(mPrimaryActionsAdapter); Activity activity = getActivity(); mPlayPauseAction = new PlayPauseAction(activity); mPrimaryActionsAdapter.add(mPlayPauseAction); setupSecondaryRowPlaybackControl(presenterSelector); mRowsAdapter.add(mPlaybackControlsRow); mRowsAdapter.notifyArrayItemRangeChanged(0, mRowsAdapter.size()); }
private void setupPrimaryRowPlaybackControl(@NonNull ControlButtonPresenterSelector presenterSelector) { mPrimaryActionsAdapter = new ArrayObjectAdapter(presenterSelector); mPlaybackControlsRow.setPrimaryActionsAdapter(mPrimaryActionsAdapter); Activity activity = getActivity(); mPlayPauseAction = new PlayPauseAction(activity); mFastForwardAction = new FastForwardAction(activity); mRewindAction = new RewindAction(activity); if (mPreviousEpisode != null) { mSkipPreviousAction = new PlaybackControlsRow.SkipPreviousAction(activity); mPrimaryActionsAdapter.add(mSkipPreviousAction); } // Add main controls to primary adapter. mPrimaryActionsAdapter.add(mRewindAction); mPrimaryActionsAdapter.add(mPlayPauseAction); mPrimaryActionsAdapter.add(mFastForwardAction); if (mNextEpisode != null) { mSkipNextAction = new PlaybackControlsRow.SkipNextAction(activity); mPrimaryActionsAdapter.add(mSkipNextAction); } }
private void setupSecondaryRowPlaybackControl(@NonNull PresenterSelector presenterSelector) { mSecondaryActionsAdapter = new ArrayObjectAdapter(presenterSelector); mPlaybackControlsRow.setSecondaryActionsAdapter(mSecondaryActionsAdapter); Activity activity = getActivity(); mScaleVideoAction = new ScaleVideoAction(activity); mClosedCaptioningAction = new ClosedCaptioningAction(activity); mClosedCaptioningAction.setIcon(getResources().getDrawable(R.drawable.ic_av_subs, null)); if (mStreamInfo!= null && mStreamInfo.getSubtitleLanguage() != null && !mStreamInfo.getSubtitleLanguage().equals(SubsProvider.SUBTITLE_LANGUAGE_NONE)) { mClosedCaptioningAction.setIndex(ClosedCaptioningAction.ON); } else { mClosedCaptioningAction.setIndex(ClosedCaptioningAction.OFF); } // Add rest of controls to secondary adapter. mSecondaryActionsAdapter.add(mScaleVideoAction); if(mSubsButtonEnabled) mSecondaryActionsAdapter.add(mClosedCaptioningAction); }
private void updateRelatedEpisodes(Map<String, List<EpisodeBaseModel>> others) { boolean updated = false; ArrayObjectAdapter adapter = (ArrayObjectAdapter) getAdapter(); for (Map.Entry<String, List<EpisodeBaseModel>> list : others.entrySet()) { String title = list.getKey(); Log.d(TAG, "More: " + title); if (ContentManagerBase.OTHER_EPISODES.equals(title)) { otherEpisodes.addAll(otherEpisodes.size(), list.getValue()); } else { ArrayObjectAdapter more = new ArrayObjectAdapter(new CardSelector()); more.addAll(0, list.getValue()); adapter.add(new ListRow(new HeaderItem(0, title), more)); } updated = true; } if (updated) { adapter.notifyArrayItemRangeChanged(0, adapter.size()); } }
private void setupRowAdapter() { VerticalGridPresenter videoGridPresenter = new VerticalGridPresenter(ZOOM_FACTOR); videoGridPresenter.setNumberOfColumns(COLUMNS); // note: The click listeners must be called before setGridPresenter for the event listeners // to be properly registered on the viewholders. setOnItemViewSelectedListener(this); setOnItemViewClickedListener(this); setGridPresenter(videoGridPresenter); PresenterSelector cardPresenterSelector = new CardPresenterSelector(getActivity()); // VideoCardViewPresenter videoCardViewPresenter = new VideoCardViewPresenter(getActivity()); mAdapter = new ArrayObjectAdapter(cardPresenterSelector); setAdapter(mAdapter); prepareEntranceTransition(); new Handler().postDelayed(new Runnable() { @Override public void run() { createRows(); } }, 1000); }
private void initUi() { PlaybackControlsRowPresenter presenter = mediaControllerHelper.createControlsRowAndPresenter(); rows = new ArrayObjectAdapter(presenter); rows.add(mediaControllerHelper.getControlsRow()); setAdapter(rows); setOnItemViewClickedListener(new OnItemViewClickedListener() { @Override public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item, RowPresenter.ViewHolder rowViewHolder, Row row) { if (item instanceof Action) { mediaControllerHelper.onActionClicked((Action) item); } } }); }
@Override public void onCurrentItemChanged(MediaMetaData currentMediaItem) { if (mPlaybackService == null) { // onMetadataChanged updates both the metadata info on the player as well as the progress bar onMetadataChanged(); return; } setMediaMetaData(currentMediaItem); if (mPlaybackService != null) { int repeatState = mPlaybackService.getRepeatState(); int mappedActionIndex = mapServiceRepeatStateToActionIndex(repeatState); // if the activity's current repeat state differs from the service's, update it with the // repeatState of the service if (mRepeatAction.getIndex() != mappedActionIndex) { mRepeatAction.setIndex(mappedActionIndex); notifyItemChanged((ArrayObjectAdapter) getControlsRow().getSecondaryActionsAdapter(), mRepeatAction); } } }
private void addPlaybackControlsRow(MediaMetadata metadata) { mPlaybackControlsRow = new PlaybackControlsRow(new MutableMediaMetadataHolder(metadata)); mRowsAdapter.add(mPlaybackControlsRow); resetPlaybackRow(); ControlButtonPresenterSelector presenterSelector = new ControlButtonPresenterSelector(); mPrimaryActionsAdapter = new ArrayObjectAdapter(presenterSelector); mPlaybackControlsRow.setPrimaryActionsAdapter(mPrimaryActionsAdapter); mPlayPauseAction = new PlayPauseAction(getActivity()); mSkipNextAction = new PlaybackControlsRow.SkipNextAction(getActivity()); mSkipPreviousAction = new PlaybackControlsRow.SkipPreviousAction(getActivity()); mPrimaryActionsAdapter.add(mSkipPreviousAction); mPrimaryActionsAdapter.add(mPlayPauseAction); mPrimaryActionsAdapter.add(mSkipNextAction); }
private void setupAdapter() { VerticalGridPresenter presenter = new VerticalGridPresenter(ZOOM_FACTOR); presenter.setNumberOfColumns(COLUMNS); setGridPresenter(presenter); CardPresenterSelector cardPresenter = new CardPresenterSelector(getActivity()); mAdapter = new ArrayObjectAdapter(cardPresenter); setAdapter(mAdapter); setOnItemViewClickedListener(new OnItemViewClickedListener() { @Override public void onItemClicked( Presenter.ViewHolder itemViewHolder, Object item, RowPresenter.ViewHolder rowViewHolder, Row row) { Card card = (Card)item; Toast.makeText(getActivity(), "Clicked on "+card.getTitle(), Toast.LENGTH_SHORT).show(); } }); }
public SampleFragmentB() { mRowsAdapter = new ArrayObjectAdapter(new ShadowRowPresenterSelector()); setAdapter(mRowsAdapter); setOnItemViewClickedListener(new OnItemViewClickedListener() { @Override public void onItemClicked( Presenter.ViewHolder itemViewHolder, Object item, RowPresenter.ViewHolder rowViewHolder, Row row) { Toast.makeText(getActivity(), "Implement click handler", Toast.LENGTH_SHORT) .show(); } }); }
private void loadRows() { List<Movie> list = MovieList.setupMovies(); mRowsAdapter = new ArrayObjectAdapter(new ListRowPresenter()); CardPresenter cardPresenter = new CardPresenter(); int i; for (i = 0; i < NUM_ROWS; i++) { if (i != 0) { Collections.shuffle(list); } ArrayObjectAdapter listRowAdapter = new ArrayObjectAdapter(cardPresenter); for (int j = 0; j < NUM_COLS; j++) { listRowAdapter.add(list.get(j % 5)); } HeaderItem header = new HeaderItem(i, MovieList.MOVIE_CATEGORY[i]); mRowsAdapter.add(new ListRow(header, listRowAdapter)); } HeaderItem gridHeader = new HeaderItem(i, "PREFERENCES"); GridItemPresenter mGridPresenter = new GridItemPresenter(); ArrayObjectAdapter gridRowAdapter = new ArrayObjectAdapter(mGridPresenter); gridRowAdapter.add(getResources().getString(R.string.grid_view)); gridRowAdapter.add(getString(R.string.error_fragment)); gridRowAdapter.add(getResources().getString(R.string.personal_settings)); mRowsAdapter.add(new ListRow(gridHeader, gridRowAdapter)); setAdapter(mRowsAdapter); }
private void notifyChanged(Action action) { ArrayObjectAdapter adapter = mPrimaryActionsAdapter; if (adapter.indexOf(action) >= 0) { adapter.notifyArrayItemRangeChanged(adapter.indexOf(action), 1); return; } adapter = mSecondaryActionsAdapter; if (adapter.indexOf(action) >= 0) { adapter.notifyArrayItemRangeChanged(adapter.indexOf(action), 1); return; } }
private void addOtherRows() { ArrayObjectAdapter listRowAdapter = new ArrayObjectAdapter(new CardPresenter()); for (Movie movie : mItems) { listRowAdapter.add(movie); } HeaderItem header = new HeaderItem(0, getString(R.string.related_movies)); mRowsAdapter.add(new ListRow(header, listRowAdapter)); }
private void setupMovieListRow() { String subcategories[] = {getString(R.string.related_movies)}; List<Movie> list = MovieList.list; Collections.shuffle(list); ArrayObjectAdapter listRowAdapter = new ArrayObjectAdapter(new CardPresenter()); for (int j = 0; j < NUM_COLS; j++) { listRowAdapter.add(list.get(j % 5)); } HeaderItem header = new HeaderItem(0, subcategories[0]); mAdapter.add(new ListRow(header, listRowAdapter)); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mJobHelper = new JobHelper(getActivity()); mDatabaseManager = new DatabaseManager(); mCategoriesAdapter = new ArrayObjectAdapter(new ListRowPresenter()); setAdapter(mCategoriesAdapter); prepareBackgroundManager(); setupUI(); setOnItemViewClickedListener(this); setOnItemViewSelectedListener(this); mJobHelper.scheduleTvShowsUpdate(); }
private void updateData() { mCategoriesAdapter = new ArrayObjectAdapter(new ListRowPresenter()); for (Season season : mTvShow.getSeasons()) { ArrayObjectAdapter episodeAdapter = new ArrayObjectAdapter(new EpisodePresenter()); episodeAdapter.addAll(0, season.getEpisodes()); if (season.isHasFullSeasonDownloadUrl()) { episodeAdapter.add(new Episode("99", getString(R.string.full_season), season, -1, null)); } mCategoriesAdapter.add(new ListRow(new HeaderItem(season.getName()), episodeAdapter)); } setAdapter(mCategoriesAdapter); }
private void setupRelatedMovieListRow() { String subcategories[] = {getString(R.string.related_movies)}; List<Movie> list = MovieList.getList(); Collections.shuffle(list); ArrayObjectAdapter listRowAdapter = new ArrayObjectAdapter(new CardPresenter()); for (int j = 0; j < NUM_COLS; j++) { listRowAdapter.add(list.get(j % 5)); } HeaderItem header = new HeaderItem(0, subcategories[0]); mAdapter.add(new ListRow(header, listRowAdapter)); mPresenterSelector.addClassPresenter(ListRow.class, new ListRowPresenter()); }
private ArrayObjectAdapter getStreamActionsAdapter(List<Stream> streams) { ArrayObjectAdapter actionsAdapter = new ArrayObjectAdapter(); streamUrlList = new ArrayList<StreamUrl>(); for (Stream s : streams) { if (s.getType().equals("video") || true) for (String key : s.getUrls().keySet()) { StreamUrl url = s.getUrls().get(key); int index = streamUrlList.size(); streamUrlList.add(url); actionsAdapter.add(new Action(index, s.getDisplay(), url.getDisplay())); } } return actionsAdapter; }