Search in sources :

Example 1 with ArrayObjectAdapter

use of android.support.v17.leanback.widget.ArrayObjectAdapter in project cw-omnibus by commonsguy.

the class RosterFragment method onRosterLoaded.

@Subscribe(sticky = true, threadMode = ThreadMode.MAIN)
public void onRosterLoaded(RosterLoadedEvent event) {
    setHeadersState(BrowseFragment.HEADERS_ENABLED);
    setTitle(getString(R.string.app_name));
    ArrayObjectAdapter rows = new ArrayObjectAdapter(new ListRowPresenter());
    PresoRoster roster = PresoRoster.getInstance();
    ArrayObjectAdapter listRowAdapter = new ArrayObjectAdapter(new PresoPresenter());
    for (int i = 0; i < roster.getPresoCount(); ++i) {
        listRowAdapter.add(roster.getPreso(i));
    }
    HeaderItem header = new HeaderItem(0, "Presentations");
    rows.add(new ListRow(header, listRowAdapter));
    setAdapter(rows);
}
Also used : ListRowPresenter(android.support.v17.leanback.widget.ListRowPresenter) ArrayObjectAdapter(android.support.v17.leanback.widget.ArrayObjectAdapter) HeaderItem(android.support.v17.leanback.widget.HeaderItem) ListRow(android.support.v17.leanback.widget.ListRow) Subscribe(org.greenrobot.eventbus.Subscribe)

Example 2 with ArrayObjectAdapter

use of android.support.v17.leanback.widget.ArrayObjectAdapter in project android-UniversalMusicPlayer by googlesamples.

the class TvPlaybackFragment method addPlaybackControlsRow.

private void addPlaybackControlsRow(MediaMetadataCompat 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);
}
Also used : SkipPreviousAction(android.support.v17.leanback.widget.PlaybackControlsRow.SkipPreviousAction) PlayPauseAction(android.support.v17.leanback.widget.PlaybackControlsRow.PlayPauseAction) ArrayObjectAdapter(android.support.v17.leanback.widget.ArrayObjectAdapter) SkipNextAction(android.support.v17.leanback.widget.PlaybackControlsRow.SkipNextAction) ControlButtonPresenterSelector(android.support.v17.leanback.widget.ControlButtonPresenterSelector) PlaybackControlsRow(android.support.v17.leanback.widget.PlaybackControlsRow)

Example 3 with ArrayObjectAdapter

use of android.support.v17.leanback.widget.ArrayObjectAdapter in project android-UniversalMusicPlayer by googlesamples.

the class TvVerticalGridFragment method setupFragment.

private void setupFragment() {
    VerticalGridPresenter gridPresenter = new VerticalGridPresenter();
    gridPresenter.setNumberOfColumns(NUM_COLUMNS);
    setGridPresenter(gridPresenter);
    mAdapter = new ArrayObjectAdapter(new CardPresenter(getActivity()));
    setAdapter(mAdapter);
    setOnItemViewClickedListener(new ItemViewClickedListener());
}
Also used : VerticalGridPresenter(android.support.v17.leanback.widget.VerticalGridPresenter) OnItemViewClickedListener(android.support.v17.leanback.widget.OnItemViewClickedListener) ArrayObjectAdapter(android.support.v17.leanback.widget.ArrayObjectAdapter)

Example 4 with ArrayObjectAdapter

use of android.support.v17.leanback.widget.ArrayObjectAdapter in project vlc-android by videolan.

the class SearchFragment method loadRows.

private void loadRows(String query) {
    final SearchAggregate searchAggregate = VLCApplication.getMLInstance().search(query);
    CardPresenter cp = new CardPresenter(mActivity);
    final ArrayObjectAdapter videoAdapter = new ArrayObjectAdapter(cp);
    videoAdapter.addAll(0, Arrays.asList(searchAggregate.getMediaSearchAggregate().getOthers()));
    final ArrayObjectAdapter episodesAdapter = new ArrayObjectAdapter(cp);
    episodesAdapter.addAll(0, Arrays.asList(searchAggregate.getMediaSearchAggregate().getEpisodes()));
    final ArrayObjectAdapter moviesAdapter = new ArrayObjectAdapter(cp);
    moviesAdapter.addAll(0, Arrays.asList(searchAggregate.getMediaSearchAggregate().getMovies()));
    final ArrayObjectAdapter songsAdapter = new ArrayObjectAdapter(cp);
    songsAdapter.addAll(0, Arrays.asList(searchAggregate.getMediaSearchAggregate().getTracks()));
    final ArrayObjectAdapter artistsAdapter = new ArrayObjectAdapter(cp);
    artistsAdapter.addAll(0, Arrays.asList(searchAggregate.getArtists()));
    final ArrayObjectAdapter albumsAdapter = new ArrayObjectAdapter(cp);
    albumsAdapter.addAll(0, Arrays.asList(searchAggregate.getAlbums()));
    final ArrayObjectAdapter genresAdapter = new ArrayObjectAdapter(cp);
    genresAdapter.addAll(0, Arrays.asList(searchAggregate.getGenres()));
    mHandler.post(new Runnable() {

        @Override
        public void run() {
            if (videoAdapter.size() > 0)
                mRowsAdapter.add(new ListRow(new HeaderItem(0, getResources().getString(R.string.videos)), videoAdapter));
            if (episodesAdapter.size() > 0)
                mRowsAdapter.add(new ListRow(new HeaderItem(0, getResources().getString(R.string.episodes)), episodesAdapter));
            if (moviesAdapter.size() > 0)
                mRowsAdapter.add(new ListRow(new HeaderItem(0, getResources().getString(R.string.movies)), moviesAdapter));
            if (songsAdapter.size() > 0)
                mRowsAdapter.add(new ListRow(new HeaderItem(0, getResources().getString(R.string.songs)), songsAdapter));
            if (artistsAdapter.size() > 0)
                mRowsAdapter.add(new ListRow(new HeaderItem(0, getResources().getString(R.string.artists)), artistsAdapter));
            if (albumsAdapter.size() > 0)
                mRowsAdapter.add(new ListRow(new HeaderItem(0, getResources().getString(R.string.albums)), albumsAdapter));
            if (genresAdapter.size() > 0)
                mRowsAdapter.add(new ListRow(new HeaderItem(0, getResources().getString(R.string.genres)), genresAdapter));
        }
    });
}
Also used : SearchAggregate(org.videolan.medialibrary.media.SearchAggregate) ArrayObjectAdapter(android.support.v17.leanback.widget.ArrayObjectAdapter) HeaderItem(android.support.v17.leanback.widget.HeaderItem) ListRow(android.support.v17.leanback.widget.ListRow)

Example 5 with ArrayObjectAdapter

use of android.support.v17.leanback.widget.ArrayObjectAdapter in project vlc-android by videolan.

the class GridFragment method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mContext = getActivity();
    VerticalGridPresenter gridPresenter = new VerticalGridPresenter();
    gridPresenter.setNumberOfColumns(NUM_COLUMNS);
    setGridPresenter(gridPresenter);
    mAdapter = new ArrayObjectAdapter(new CardPresenter(mContext));
    mAdapter.clear();
    setAdapter(mAdapter);
}
Also used : VerticalGridPresenter(android.support.v17.leanback.widget.VerticalGridPresenter) CardPresenter(org.videolan.vlc.gui.tv.CardPresenter) ArrayObjectAdapter(android.support.v17.leanback.widget.ArrayObjectAdapter)

Aggregations

ArrayObjectAdapter (android.support.v17.leanback.widget.ArrayObjectAdapter)33 HeaderItem (android.support.v17.leanback.widget.HeaderItem)16 ListRow (android.support.v17.leanback.widget.ListRow)13 ListRowPresenter (android.support.v17.leanback.widget.ListRowPresenter)13 ClassPresenterSelector (android.support.v17.leanback.widget.ClassPresenterSelector)8 Intent (android.content.Intent)5 DetailsOverviewRow (android.support.v17.leanback.widget.DetailsOverviewRow)4 FullWidthDetailsOverviewRowPresenter (android.support.v17.leanback.widget.FullWidthDetailsOverviewRowPresenter)4 Card (cx.ring.tv.cards.Card)4 CardPresenterSelector (cx.ring.tv.cards.CardPresenterSelector)4 ContactCard (cx.ring.tv.cards.contacts.ContactCard)4 IconCard (cx.ring.tv.cards.iconcards.IconCard)4 Activity (android.app.Activity)3 Bundle (android.os.Bundle)3 OnItemViewClickedListener (android.support.v17.leanback.widget.OnItemViewClickedListener)3 VerticalGridPresenter (android.support.v17.leanback.widget.VerticalGridPresenter)3 MediaCardPresenter (butter.droid.tv.presenters.MediaCardPresenter)3 CardListRow (cx.ring.tv.cards.CardListRow)3 CardRow (cx.ring.tv.cards.CardRow)3 ContactRequestCard (cx.ring.tv.cards.contactrequests.ContactRequestCard)3