Search in sources :

Example 1 with HeaderItem

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));
}
Also used : Bundle(android.os.Bundle) HeaderItem(androidx.leanback.widget.HeaderItem)

Example 2 with HeaderItem

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);
    }
}
Also used : VideoGroupObjectAdapter(com.liskovsoft.smartyoutubetv2.tv.adapter.VideoGroupObjectAdapter) HeaderItem(androidx.leanback.widget.HeaderItem) ListRow(androidx.leanback.widget.ListRow)

Example 3 with HeaderItem

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);
    }
}
Also used : PageRow(androidx.leanback.widget.PageRow) HeaderItem(androidx.leanback.widget.HeaderItem)

Example 4 with HeaderItem

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());
    }
}
Also used : PageRow(androidx.leanback.widget.PageRow) ColorDrawable(android.graphics.drawable.ColorDrawable) Drawable(android.graphics.drawable.Drawable) TextView(android.widget.TextView) HeaderItem(androidx.leanback.widget.HeaderItem) ImageView(android.widget.ImageView) ImageView(android.widget.ImageView) TextView(android.widget.TextView) View(android.view.View)

Example 5 with HeaderItem

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);
}
Also used : ListRowPresenter(androidx.leanback.widget.ListRowPresenter) GridItemPresenter(ml.bmlzootown.hydravion.browse.GridItemPresenter) Video(ml.bmlzootown.hydravion.models.Video) CardPresenter(ml.bmlzootown.hydravion.card.CardPresenter) ArrayObjectAdapter(androidx.leanback.widget.ArrayObjectAdapter) HeaderItem(androidx.leanback.widget.HeaderItem) Subscription(ml.bmlzootown.hydravion.subscription.Subscription) ListRow(androidx.leanback.widget.ListRow) SuppressLint(android.annotation.SuppressLint)

Aggregations

HeaderItem (androidx.leanback.widget.HeaderItem)55 ListRow (androidx.leanback.widget.ListRow)50 ArrayObjectAdapter (androidx.leanback.widget.ArrayObjectAdapter)37 CardPresenter (com.amazon.android.tv.tenfoot.presenter.CardPresenter)9 ItemRowAdapter (org.jellyfin.androidtv.ui.itemhandling.ItemRowAdapter)9 ListRowPresenter (androidx.leanback.widget.ListRowPresenter)6 Content (com.amazon.android.model.content.Content)6 ContentContainer (com.amazon.android.model.content.ContentContainer)6 SettingsCardPresenter (com.amazon.android.tv.tenfoot.presenter.SettingsCardPresenter)6 PlaylistAction (com.amazon.android.model.PlaylistAction)5 PosterCardPresenter (com.amazon.android.tv.tenfoot.presenter.PosterCardPresenter)5 CardPresenter (org.jellyfin.androidtv.ui.presentation.CardPresenter)5 ClassPresenterSelector (androidx.leanback.widget.ClassPresenterSelector)4 VideoGroupObjectAdapter (com.liskovsoft.smartyoutubetv2.tv.adapter.VideoGroupObjectAdapter)4 GridButtonPresenter (org.jellyfin.androidtv.ui.presentation.GridButtonPresenter)4 PositionableListRowPresenter (org.jellyfin.androidtv.ui.presentation.PositionableListRowPresenter)4 Bundle (android.os.Bundle)3 Handler (android.os.Handler)3 ImageView (android.widget.ImageView)3 MediaCardPresenter (butter.droid.tv.presenters.MediaCardPresenter)3