當前位置: 首頁>>代碼示例>>Java>>正文


Java HeaderItem類代碼示例

本文整理匯總了Java中android.support.v17.leanback.widget.HeaderItem的典型用法代碼示例。如果您正苦於以下問題:Java HeaderItem類的具體用法?Java HeaderItem怎麽用?Java HeaderItem使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


HeaderItem類屬於android.support.v17.leanback.widget包,在下文中一共展示了HeaderItem類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getRelatedItems

import android.support.v17.leanback.widget.HeaderItem; //導入依賴的package包/類
private Row getRelatedItems() {
	ArrayObjectAdapter listRowAdapter = new ArrayObjectAdapter(new CardPresenter());
	final Set<Long> related = mSelectedEvent.getMetadata().getRelated().keySet();
	mDisposables.add(((LeanbackBaseActivity) getActivity()).getApiServiceObservable()
			.observeOn(AndroidSchedulers.mainThread())
			.subscribe(
					mediaApiService -> {
						for (long id : related) {
							mDisposables.add(mediaApiService.getEvent(id)
									.observeOn(AndroidSchedulers.mainThread())
									.subscribe(event -> listRowAdapter.add(event)));
						}
						listRowAdapter.notifyArrayItemRangeChanged(0, listRowAdapter.size());
					}
			)
	);
	HeaderItem header = new HeaderItem(0, getString(R.string.related_talks));
	return new ListRow(header, listRowAdapter);
}
 
開發者ID:NiciDieNase,項目名稱:chaosflix-leanback,代碼行數:20,代碼來源:OverlayFragment.java

示例2: onBindViewHolder

import android.support.v17.leanback.widget.HeaderItem; //導入依賴的package包/類
@Override
public void onBindViewHolder(Presenter.ViewHolder viewHolder, Object item) {
	HeaderItem headerItem = ((ListRow) item).getHeaderItem();
	View view = viewHolder.view;
	ImageView headerIcon = (ImageView) view.findViewById(R.id.header_icon);
	TextView headerLabel = (TextView) view.findViewById(R.id.header_label);

	Resources resources = view.getContext().getResources();
	String streamingPrefix = resources.getString(R.string.streaming_prefix);
	if (headerItem.getName().startsWith(streamingPrefix)) {
		Drawable camIcon = resources.getDrawable(R.drawable.ic_videocam_white_24dp);
		headerIcon.setImageDrawable(camIcon);
		((ListRow) item).setHeaderItem(new HeaderItem(headerItem.getName()
				.substring(streamingPrefix.length())));
	} else {
		Drawable movieIcon = resources.getDrawable(R.drawable.ic_local_movies_white_24dp);
		headerIcon.setImageDrawable(movieIcon);
		headerLabel.setText(headerItem.getName());
	}
}
 
開發者ID:NiciDieNase,項目名稱:chaosflix-leanback,代碼行數:21,代碼來源:HeaderItemPresenter.java

示例3: onLoadFinished

import android.support.v17.leanback.widget.HeaderItem; //導入依賴的package包/類
@Override
public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) {
    int titleRes;
    if (cursor != null && cursor.moveToFirst()) {
        mResultsFound = true;
        titleRes = R.string.search_results;
    } else {
        mResultsFound = false;
        titleRes = R.string.no_search_results;
    }
    mVideoCursorAdapter.changeCursor(cursor);
    HeaderItem header = new HeaderItem(getString(titleRes, mQuery));
    mRowsAdapter.clear();
    ListRow row = new ListRow(header, mVideoCursorAdapter);
    mRowsAdapter.add(row);
}
 
開發者ID:nejtv,項目名稱:androidtv-sample,代碼行數:17,代碼來源:SearchFragment.java

示例4: getRelatedItems

import android.support.v17.leanback.widget.HeaderItem; //導入依賴的package包/類
private Row getRelatedItems() {
	ArrayObjectAdapter listRowAdapter = new ArrayObjectAdapter(new CardPresenter());
	final long[] related = mSelectedEvent.getMetadata().getRelated();
	mDisposables.add(((LeanbackBaseActivity) getActivity()).getApiServiceObservable()
			.observeOn(AndroidSchedulers.mainThread())
			.subscribe(
					mediaApiService -> {
						for (long id : related) {
							mDisposables.add(mediaApiService.getEvent(id)
									.observeOn(AndroidSchedulers.mainThread())
									.subscribe(event -> listRowAdapter.add(event)));
						}
						listRowAdapter.notifyArrayItemRangeChanged(0, listRowAdapter.size());
					}
			)
	);
	HeaderItem header = new HeaderItem(0, getString(R.string.related_talks));
	return new ListRow(header, listRowAdapter);
}
 
開發者ID:NiciDieNase,項目名稱:chaosflix,代碼行數:20,代碼來源:OverlayFragment.java

示例5: addStreams

import android.support.v17.leanback.widget.HeaderItem; //導入依賴的package包/類
private void addStreams(CardPresenter cardPresenter, List<LiveConference> liveConferences) {
		if (liveConferences.size() > 0) {
			HeaderItem streamingHeader = new HeaderItem(getString(R.string.livestreams));
			mStreamingSection = new SectionRow(streamingHeader);
			mRowsAdapter.add(0, mStreamingSection);
			for (LiveConference con : liveConferences) {
				if(!con.getConference().equals("Sendeschleife")){
					int i = -1;
					for (i = 0; i < con.getGroups().size(); i++) {
						Group g = con.getGroups().get(i);
						// setup header
						String group = g.getGroup().length() > 0 ? g.getGroup() : con.getConference();
						HeaderItem header = new HeaderItem(group);
						header.setDescription(con.getConference() + " - " + con.getDescription());
						header.setContentDescription(group);
						// setup list
						ArrayObjectAdapter listRowAdapter
								= new ArrayObjectAdapter(cardPresenter);
						listRowAdapter.addAll(listRowAdapter.size(), g.getRooms());
						mRowsAdapter.add(i + 1, new ListRow(header, listRowAdapter));
					}
				}
//				mRowsAdapter.add(i + 1, new DividerRow());
			}
		}
	}
 
開發者ID:NiciDieNase,項目名稱:chaosflix,代碼行數:27,代碼來源:ConferencesBrowseFragment.java

示例6: onBindViewHolder

import android.support.v17.leanback.widget.HeaderItem; //導入依賴的package包/類
@Override
public void onBindViewHolder(Presenter.ViewHolder viewHolder, Object item) {
    HeaderItem headerItem = ((ListRow) item).getHeaderItem();
    View rootView = viewHolder.view;
    rootView.setFocusable(true);

    ImageView iconView = (ImageView) rootView.findViewById(R.id.header_icon);
    Drawable icon = rootView.getResources().getDrawable(R.drawable.icon_movies, null);
    iconView.setImageDrawable(icon);

    TextView label = (TextView) rootView.findViewById(R.id.header_label);
    label.setText(headerItem.getName());
}
 
開發者ID:ad-on-is,項目名稱:chilly,代碼行數:14,代碼來源:IconHeaderItemPresenter.java

示例7: createNewSeasonRow

import android.support.v17.leanback.widget.HeaderItem; //導入依賴的package包/類
private ListRow createNewSeasonRow(String seasonNumber, int position) {
    String seasonTitle = seasonNumber.isEmpty() ? mSeries.getTitle()
            : getString(R.string.dvr_detail_series_season_title, seasonNumber);
    HeaderItem header = new HeaderItem(mSeasonRowCount++, seasonTitle);
    ClassPresenterSelector selector = new ClassPresenterSelector();
    selector.addClassPresenter(RecordedProgram.class, mRecordedProgramPresenter);
    ListRow row = new ListRow(header, new SeasonRowAdapter(selector,
            new Comparator<RecordedProgram>() {
                @Override
                public int compare(RecordedProgram lhs, RecordedProgram rhs) {
                    return BaseProgram.EPISODE_COMPARATOR.compare(lhs, rhs);
                }
            }, seasonNumber));
    getRowsAdapter().add(position, row);
    return row;
}
 
開發者ID:trevd,項目名稱:android_packages_apps_tv,代碼行數:17,代碼來源:SeriesRecordingDetailsFragment.java

示例8: loadRows

import android.support.v17.leanback.widget.HeaderItem; //導入依賴的package包/類
private void loadRows() {
    mRowsAdapter = new ArrayObjectAdapter(new ListRowPresenter());

    mApkDownloadHelper = new ApkDownloadHelper(getActivity());
    // Setup the package installer for the session
    mApkDownloadHelper.addListener(mDownloadListener);
    HeaderItem header = null;

    if (getResources().getBoolean(R.bool.ENABLE_APP_REPO)) {
        createRowApkDownloads();
    }

    if (getResources().getBoolean(R.bool.ENABLE_DOWNLOADS_ROW)) {
        createRowDownloadedApks();
    }

    createRowShortcutGenerator();

    createRowCustomShortcuts();

    createRowMisc();

    setAdapter(mRowsAdapter);
}
 
開發者ID:ITVlab,項目名稱:TvAppRepo,代碼行數:25,代碼來源:MainFragment.java

示例9: setupMoreMovies

import android.support.v17.leanback.widget.HeaderItem; //導入依賴的package包/類
private void setupMoreMovies() {
    HeaderItem moreMoviesHeader = new HeaderItem(1, getString(R.string.more_movies));
    MorePresenter morePresenter = new MorePresenter(getActivity());
    ArrayObjectAdapter moreRowAdapter = new ArrayObjectAdapter(morePresenter);

    // add items
    List<MediaProvider.NavInfo> navigation = mMoviesProvider.getNavigation();
    for (MediaProvider.NavInfo info : navigation) {
        moreRowAdapter.add(new MorePresenter.MoreItem(
                info.getId(),
                info.getLabel(),
                info.getIcon(),
                info));
    }

    mRowsAdapter.add(new ListRow(moreMoviesHeader, moreRowAdapter));
}
 
開發者ID:PTCE,項目名稱:popcorn-android,代碼行數:18,代碼來源:PTVOverviewFragment.java

示例10: setupMoreTVShows

import android.support.v17.leanback.widget.HeaderItem; //導入依賴的package包/類
private void setupMoreTVShows() {
    HeaderItem moreHeader = new HeaderItem(1, getString(R.string.more_shows));
    MorePresenter morePresenter = new MorePresenter(getActivity());
    ArrayObjectAdapter moreRowAdapter = new ArrayObjectAdapter(morePresenter);

    // add items
    List<MediaProvider.NavInfo> navigation = mShowsProvider.getNavigation();
    for (MediaProvider.NavInfo info : navigation) {
        moreRowAdapter.add(new MorePresenter.MoreItem(
                info.getId(),
                info.getLabel(),
                info.getIcon(),
                info));
    }

    mRowsAdapter.add(new ListRow(moreHeader, moreRowAdapter));
}
 
開發者ID:PTCE,項目名稱:popcorn-android,代碼行數:18,代碼來源:PTVOverviewFragment.java

示例11: createCardRow

import android.support.v17.leanback.widget.HeaderItem; //導入依賴的package包/類
private Row createCardRow(final CardRow cardRow) {
    switch (cardRow.getType()) {
        case CardRow.TYPE_SECTION_HEADER:
            return new SectionRow(new HeaderItem(cardRow.getTitle()));
        case CardRow.TYPE_DIVIDER:
            return new DividerRow();
        case CardRow.TYPE_DEFAULT:
        default:
            // Build main row using the ImageCardViewPresenter.
            PresenterSelector presenterSelector = new CardPresenterSelector(getActivity());
            ArrayObjectAdapter listRowAdapter = new ArrayObjectAdapter(presenterSelector);
            for (Card card : cardRow.getCards()) {
                listRowAdapter.add(card);
            }
            return new CardListRow(new HeaderItem(cardRow.getTitle()), listRowAdapter, cardRow);
    }
}
 
開發者ID:googlesamples,項目名稱:leanback-showcase,代碼行數:18,代碼來源:CardExampleFragment.java

示例12: createRows

import android.support.v17.leanback.widget.HeaderItem; //導入依賴的package包/類
private void createRows() {
    HeaderItem headerItem1 = new HeaderItem(HEADER_ID_1, HEADER_NAME_1);
    PageRow pageRow1 = new PageRow(headerItem1);
    mRowsAdapter.add(pageRow1);

    HeaderItem headerItem2 = new HeaderItem(HEADER_ID_2, HEADER_NAME_2);
    PageRow pageRow2 = new PageRow(headerItem2);
    mRowsAdapter.add(pageRow2);

    HeaderItem headerItem3 = new HeaderItem(HEADER_ID_3, HEADER_NAME_3);
    PageRow pageRow3 = new PageRow(headerItem3);
    mRowsAdapter.add(pageRow3);

    HeaderItem headerItem4 = new HeaderItem(HEADER_ID_4, HEADER_NAME_4);
    PageRow pageRow4 = new PageRow(headerItem4);
    mRowsAdapter.add(pageRow4);
}
 
開發者ID:googlesamples,項目名稱:leanback-showcase,代碼行數:18,代碼來源:PageAndListRowFragment.java

示例13: updateRelatedEpisodes

import android.support.v17.leanback.widget.HeaderItem; //導入依賴的package包/類
private void updateRelatedEpisodes(Map<String, List<EpisodeBaseModel>> others) {
    boolean updated = false;
    ArrayObjectAdapter adapter = (ArrayObjectAdapter) getAdapter();
    for (Map.Entry<String, List<EpisodeBaseModel>> list : others.entrySet()) {
        String title = list.getKey();
        Log.d(TAG, "More: " + title);
        if (ContentManagerBase.OTHER_EPISODES.equals(title)) {
            otherEpisodes.addAll(otherEpisodes.size(), list.getValue());
        } else {
            ArrayObjectAdapter more = new ArrayObjectAdapter(new CardSelector());
            more.addAll(0, list.getValue());
            adapter.add(new ListRow(new HeaderItem(0, title), more));
        }
        updated = true;
    }
    if (updated) {
        adapter.notifyArrayItemRangeChanged(0, adapter.size());
    }
}
 
開發者ID:nextux,項目名稱:sbs-android-tv,代碼行數:20,代碼來源:DetailsFragment.java

示例14: init

import android.support.v17.leanback.widget.HeaderItem; //導入依賴的package包/類
public void init() {
    mRowsAdapter = new ArrayObjectAdapter(new ListRowPresenter());
    setAdapter(mRowsAdapter);

    setBrandColor(ContextCompat.getColor(getContext(), R.color.primary));
    setBadgeDrawable(ContextCompat.getDrawable(getContext(), R.drawable.filmi));

    for (int position = 0; position < HEADERS.length; position++) {
        ObjectAdapter rowContents = new CursorObjectAdapter((new SinglePresenterSelector(new CardPresenter())));
        VideoDataManager manager = new VideoDataManager(getActivity(), getLoaderManager(), VideoItemContract.VideoItem.buildDirUri(), rowContents);
        manager.startDataLoading();

        HeaderItem headerItem = new HeaderItem(position, HEADERS[position]);
        mRowsAdapter.add(new ListRow(headerItem, manager.getItemList()));
    }

    setOnItemViewClickedListener(getDefaultItemViewClickedListener());
    setOnItemViewSelectedListener(getDefaultItemSelectedListener());

    bgHelper = new BackgroundHelper(getActivity());
    bgHelper.prepareBackgroundManager();

}
 
開發者ID:googlecodelabs,項目名稱:android-tv-leanback,代碼行數:24,代碼來源:LeanbackBrowseFragment.java

示例15: init

import android.support.v17.leanback.widget.HeaderItem; //導入依賴的package包/類
public void init() {
    mRowsAdapter = new ArrayObjectAdapter(new ListRowPresenter());
    setAdapter(mRowsAdapter);

    setBrandColor(ContextCompat.getColor(getContext(), R.color.primary));
    setBadgeDrawable(ContextCompat.getDrawable(getContext(), R.drawable.filmi));

    for (int position = 0; position < HEADERS.length; position++) {
        ObjectAdapter rowContents = new CursorObjectAdapter((new SinglePresenterSelector(new CardPresenter())));
        VideoDataManager manager = new VideoDataManager(getActivity(), getLoaderManager(), VideoItemContract.VideoItem.buildDirUri(), rowContents);
        manager.startDataLoading();

        HeaderItem headerItem = new HeaderItem(position, HEADERS[position]);
        mRowsAdapter.add(new ListRow(headerItem, manager.getItemList()));
    }

    setOnItemViewClickedListener(getDefaultItemViewClickedListener());

}
 
開發者ID:googlecodelabs,項目名稱:android-tv-leanback,代碼行數:20,代碼來源:LeanbackBrowseFragment.java


注:本文中的android.support.v17.leanback.widget.HeaderItem類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。