use of com.amazon.android.model.PlaylistAction in project zype-firebuilder by zype.
the class ZypePlaylistContentBrowseFragment method loadRootContentContainer.
private void loadRootContentContainer(ArrayObjectAdapter rowsAdapter) {
Log.d(TAG, "loadRootContentContainer()");
rowsAdapter.clear();
ContentContainer rootContentContainer = ContentBrowser.getInstance(getActivity()).getLastSelectedContentContainer();
boolean isMyLibrary = rootContentContainer.getExtraStringValue(Recipe.KEY_DATA_TYPE_TAG).equals(ZypeSettings.ROOT_MY_LIBRARY_PLAYLIST_ID);
boolean isFavorites = rootContentContainer.getExtraStringValue(Recipe.KEY_DATA_TYPE_TAG).equals(ZypeSettings.ROOT_FAVORITES_PLAYLIST_ID);
CardPresenter cardPresenter = new CardPresenter();
PosterCardPresenter posterCardPresenter = new PosterCardPresenter();
for (ContentContainer contentContainer : rootContentContainer.getContentContainers()) {
if (isMyLibrary && contentContainer.getContents().isEmpty() && isDataLoaded) {
dialogError = ErrorDialogFragment.newInstance(getActivity(), ErrorUtils.ERROR_CATEGORY.ZYPE_MY_LIBRARY_ERROR_EMPTY, (ErrorDialogFragment.ErrorDialogFragmentListener) getActivity());
dialogError.show(getFragmentManager(), ErrorDialogFragment.FRAGMENT_TAG_NAME);
break;
}
if (isFavorites) {
if (contentContainer.getContents().isEmpty() && ContentBrowser.getInstance(getActivity()).isFavoritesLoaded()) {
showEmptyFavorites();
break;
}
}
HeaderItem header = new HeaderItem(0, contentContainer.getName());
ArrayObjectAdapter listRowAdapter = new ArrayObjectAdapter(cardPresenter);
if (contentContainer.getExtraStringValue(ContentContainer.EXTRA_THUMBNAIL_LAYOUT).equals("poster")) {
listRowAdapter = new ArrayObjectAdapter(posterCardPresenter);
}
for (ContentContainer innerContentContainer : contentContainer.getContentContainers()) {
listRowAdapter.add(innerContentContainer);
}
for (Content content : contentContainer.getContents()) {
listRowAdapter.add(content);
}
if (isMyLibrary) {
if (rootContentContainer.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(getString(R.string.action_load_more));
listRowAdapter.add(action);
}
} else if (isFavorites) {
} else {
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(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));
}
// addSettingsActionsToRowAdapter(rowsAdapter);
// isDataLoaded = false;
addStubRow(rowsAdapter);
}
Aggregations