use of com.amazon.android.tv.tenfoot.presenter.CardPresenter in project zype-firebuilder by zype.
the class BrowseHelper method loadRootContentContainer.
/**
* Loads the content from the root content container into the rows adapter.
*
* @param activity The activity.
* @param rowsAdapter The rows adapter.
*/
public static void loadRootContentContainer(Activity activity, ArrayObjectAdapter rowsAdapter) {
ContentContainer rootContentContainer = ContentBrowser.getInstance(activity).getRootContentContainer();
CardPresenter cardPresenter = new CardPresenter();
/* Zype, Evgeny Cherkasov */
PosterCardPresenter posterCardPresenter = new PosterCardPresenter();
for (ContentContainer contentContainer : rootContentContainer.getContentContainers()) {
// Don't show My Library and Favorites content container
if (contentContainer.getExtraStringValue(Recipe.KEY_DATA_TYPE_TAG).equals(ZypeSettings.ROOT_MY_LIBRARY_PLAYLIST_ID) || contentContainer.getExtraStringValue(Recipe.KEY_DATA_TYPE_TAG).equals(ZypeSettings.ROOT_FAVORITES_PLAYLIST_ID) || contentContainer.getExtraStringValue(Recipe.KEY_DATA_TYPE_TAG).equals(ZypeSettings.ROOT_SLIDERS_PLAYLIST_ID)) {
continue;
}
HeaderItem header = new HeaderItem(0, contentContainer.getName());
ArrayObjectAdapter listRowAdapter = new ArrayObjectAdapter(cardPresenter);
/* Zype, Evgeny Cherkasov */
if (contentContainer.getExtraStringValue(ContentContainer.EXTRA_THUMBNAIL_LAYOUT).equals("poster")) {
listRowAdapter = new ArrayObjectAdapter(posterCardPresenter);
}
for (ContentContainer innerContentContainer : contentContainer.getContentContainers()) {
listRowAdapter.add(innerContentContainer);
}
// TODO: Probably it would better to move updating NextPage to the getContentsObservable()
if (contentContainer.getExtraValueAsInt(ExtraKeys.NEXT_PAGE) == 1) {
if (contentContainer.getExtraValueAsInt(ContentContainer.EXTRA_PLAYLIST_ITEM_COUNT) > ZypeApi.PER_PAGE_DEFAULT) {
contentContainer.setExtraValue(ExtraKeys.NEXT_PAGE, 2);
} else {
contentContainer.setExtraValue(ExtraKeys.NEXT_PAGE, -1);
}
}
for (Content content : contentContainer.getContents()) {
if (contentContainer.getExtraValueAsInt(ExtraKeys.NEXT_PAGE) > 0 && contentContainer.getContents().indexOf(content) == contentContainer.getContentCount() - 1) {
content.setExtraValue(ContentBrowser.NEXT_PAGE, true);
content.setExtraValue(Content.EXTRA_PLAYLIST_ID, contentContainer.getExtraStringValue(Recipe.KEY_DATA_TYPE_TAG));
}
listRowAdapter.add(content);
}
/* if (contentContainer.getExtraValueAsInt(ExtraKeys.NEXT_PAGE) > 0) {
PlaylistAction action = new PlaylistAction();
action.setAction(ContentBrowser.NEXT_PAGE)
.setIconResourceId(com.amazon.android.contentbrowser.R.drawable.ic_add_white_48dp)
.setLabel1("activity.getString(R.string.action_load_more)");
action.setExtraValue(PlaylistAction.EXTRA_PLAYLIST_ID, contentContainer.getExtraStringValue(Recipe.KEY_DATA_TYPE_TAG));
listRowAdapter.add(action);
}*/
rowsAdapter.add(new ListRow(header, listRowAdapter));
}
}
Aggregations