use of android.support.v17.leanback.widget.ListRowPresenter 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);
}
use of android.support.v17.leanback.widget.ListRowPresenter in project android-UniversalMusicPlayer by googlesamples.
the class TvPlaybackFragment method updatePlayListRow.
protected void updatePlayListRow(List<MediaSessionCompat.QueueItem> playlistQueue) {
if (QueueHelper.equals(mPlaylistQueue, playlistQueue)) {
// if the playlist queue hasn't changed, we don't need to update it
return;
}
LogHelper.d(TAG, "Updating playlist queue ('now playing')");
mPlaylistQueue = playlistQueue;
if (playlistQueue == null || playlistQueue.isEmpty()) {
// Remove the playlist row if no items are in the playlist
mRowsAdapter.remove(mListRow);
mListRow = null;
return;
}
mListRowAdapter.clear();
for (int i = 0; i < playlistQueue.size(); i++) {
MediaSessionCompat.QueueItem item = playlistQueue.get(i);
mListRowAdapter.add(item);
}
if (mListRow == null) {
int queueSize = 0;
MediaControllerCompat controller = getActivity().getSupportMediaController();
if (controller != null && controller.getQueue() != null) {
queueSize = controller.getQueue().size();
}
HeaderItem header = new HeaderItem(0, queueSize + " song(s) in this playlist");
mPresenterSelector.addClassPresenter(ListRow.class, new ListRowPresenter());
mListRow = new ListRow(header, mListRowAdapter);
mRowsAdapter.add(mListRow);
} else {
mRowsAdapter.notifyArrayItemRangeChanged(mRowsAdapter.indexOf(mListRow), 1);
}
}
use of android.support.v17.leanback.widget.ListRowPresenter in project cw-omnibus by commonsguy.
the class VideosFragment method onLoadFinished.
@Override
public void onLoadFinished(Loader<Cursor> loader, Cursor c) {
mapCursorToModels(c);
setHeadersState(BrowseFragment.HEADERS_ENABLED);
setTitle(getString(R.string.app_name));
ArrayObjectAdapter rows = new ArrayObjectAdapter(new ListRowPresenter());
ArrayObjectAdapter listRowAdapter = new ArrayObjectAdapter(new VideoPresenter(getActivity()));
for (Video v : videos) {
listRowAdapter.add(v);
}
HeaderItem header = new HeaderItem(0, "Videos", null);
rows.add(new ListRow(header, listRowAdapter));
setAdapter(rows);
}
use of android.support.v17.leanback.widget.ListRowPresenter in project android-UniversalMusicPlayer by googlesamples.
the class TvBrowseFragment method loadRows.
private void loadRows() {
mRowsAdapter = new ArrayObjectAdapter(new ListRowPresenter());
setAdapter(mRowsAdapter);
}
Aggregations