Created
October 11, 2016 23:26
-
-
Save fnk0/b81ec47efa12cb4484853a7b166e7cec to your computer and use it in GitHub Desktop.
Create Rows
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Creates the rows and sets up the adapter of the fragment | |
*/ | |
private void createRows() { | |
// Creates the RowsAdapter for the Fragment | |
// The ListRowPresenter tells to render ListRow objects | |
ArrayObjectAdapter rowsAdapter = new ArrayObjectAdapter(new ListRowPresenter()); | |
for (int i = 0; i < mRows.size(); i++) { | |
MovieRow row = mRows.get(i); | |
// Adds a new ListRow to the adapter. Each row will contain a collection of Movies | |
// That will be rendered using the MoviePresenter | |
HeaderItem headerItem = new HeaderItem(row.getId(), row.getTitle()); | |
ListRow listRow = new ListRow(headerItem, row.getAdapter()); | |
rowsAdapter.add(listRow); | |
} | |
// Sets this fragments Adapter. | |
// The setAdapter method is defined in the BrowseFragment of the Leanback Library | |
setAdapter(rowsAdapter); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment