use of androidx.leanback.widget.HeaderItem in project SmartTubeNext by yuliskov.
the class VideoDetailsFragment method setupMovieListRow.
private void setupMovieListRow() {
String[] subcategories = { getString(R.string.related_movies) };
// Generating related video list.
String category = mSelectedVideo.category;
Bundle args = new Bundle();
args.putString(VideoContract.VideoEntry.COLUMN_CATEGORY, category);
// getLoaderManager().initLoader(RELATED_VIDEO_LOADER, args, this);
HeaderItem header = new HeaderItem(0, subcategories[0]);
// TODO: add real rows
// mAdapter.add(new ListRow(header, mVideoCursorAdapter));
}
use of androidx.leanback.widget.HeaderItem in project SmartTubeNext by yuliskov.
the class SearchFragment method updateSearch.
@Override
public void updateSearch(VideoGroup group) {
int titleRes;
if (group.getVideos() != null) {
mResultsFound = true;
titleRes = R.string.search_results;
} else {
mResultsFound = false;
titleRes = R.string.no_search_results;
}
if (mRowsAdapter.size() == 0) {
HeaderItem header = new HeaderItem(getString(titleRes, mQuery));
mAdapter = new VideoGroupObjectAdapter(group, mCardPresenter);
ListRow row = new ListRow(header, mAdapter);
mRowsAdapter.add(row);
} else {
mAdapter.append(group);
}
}
use of androidx.leanback.widget.HeaderItem in project SmartTubeNext by yuliskov.
the class BrowseFragment method createHeader.
private void createHeader(int index, BrowseSection header) {
HeaderItem headerItem = new SectionHeaderItem(header);
PageRow pageRow = new PageRow(headerItem);
if (index == -1 || mSectionRowAdapter.size() < index) {
// add to the end
mSectionRowAdapter.add(pageRow);
} else {
mSectionRowAdapter.add(index, pageRow);
}
}
use of androidx.leanback.widget.HeaderItem in project SmartTubeNext by yuliskov.
the class IconHeaderItemPresenter method onBindViewHolder.
@Override
public void onBindViewHolder(Presenter.ViewHolder viewHolder, Object item) {
HeaderItem headerItem;
if (item instanceof PageRow) {
headerItem = ((PageRow) item).getHeaderItem();
} else {
headerItem = ((ListRow) item).getHeaderItem();
}
View rootView = viewHolder.view;
rootView.setFocusable(true);
ImageView iconView = rootView.findViewById(R.id.header_icon);
if (iconView != null) {
if (mIconUrl != null) {
Glide.with(rootView.getContext()).load(mIconUrl).apply(ViewUtil.glideOptions().error(mDefaultIcon)).listener(mErrorListener).into(iconView);
// ViewUtil.makeMonochrome(iconView);
} else {
Drawable icon = mResId > 0 ? ContextCompat.getDrawable(rootView.getContext(), mResId) : mDefaultIcon;
iconView.setImageDrawable(icon);
}
}
TextView label = rootView.findViewById(R.id.header_label);
if (label != null) {
label.setText(headerItem.getName());
}
}
use of androidx.leanback.widget.HeaderItem in project Hydravion-AndroidTV by bmlzootown.
the class PlaybackActivity method quickRefreshRows.
private void quickRefreshRows() {
List<Subscription> subs = subscriptions;
ArrayObjectAdapter rowsAdapter = new ArrayObjectAdapter(new ListRowPresenter());
CardPresenter cardPresenter = new CardPresenter();
int i;
for (i = 0; i < subs.size(); i++) {
ArrayObjectAdapter listRowAdapter = new ArrayObjectAdapter(cardPresenter);
Subscription sub = subscriptions.get(i);
List<Video> vids = videos.get(sub.getCreator());
if (vids != null) {
vids.forEach(listRowAdapter::add);
}
HeaderItem header = new HeaderItem(i, sub.getPlan().getTitle());
rowsAdapter.add(new ListRow(header, listRowAdapter));
}
HeaderItem gridHeader = new HeaderItem(i, getString(R.string.settings));
GridItemPresenter mGridPresenter = new GridItemPresenter();
ArrayObjectAdapter gridRowAdapter = new ArrayObjectAdapter(mGridPresenter);
gridRowAdapter.add(getResources().getString(R.string.refresh));
gridRowAdapter.add(getResources().getString(R.string.live_stream));
// gridRowAdapter.add(getResources().getString(R.string.select_server));
gridRowAdapter.add(getResources().getString(R.string.app_info));
gridRowAdapter.add(getResources().getString(R.string.logout));
rowsAdapter.add(new ListRow(gridHeader, gridRowAdapter));
bsf.setAdapter(rowsAdapter);
}
Aggregations