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


Java ListRow類代碼示例

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


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

示例1: getRelatedItems

import android.support.v17.leanback.widget.ListRow; //導入依賴的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.ListRow; //導入依賴的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.ListRow; //導入依賴的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.ListRow; //導入依賴的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.ListRow; //導入依賴的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: onPostExecute

import android.support.v17.leanback.widget.ListRow; //導入依賴的package包/類
@Override
protected void onPostExecute(Void avoid) {
    ClassPresenterSelector ps = new ClassPresenterSelector();
    ps.addClassPresenter(DetailsOverviewRow.class, mOverviewRowPresenter);
    ps.addClassPresenter(PlotAndGenresRow.class, new PlotAndGenresRowPresenter(16,mColor)); // 16 lines max to fit on screen
    ps.addClassPresenter(FullTextRow.class, new FullTextRowPresenter(18,mColor)); // 18 lines max to fit on screen
    ps.addClassPresenter(ListRow.class, new ListRowPresenter());
    mOverviewRowPresenter.setBackgroundColor(mColor);
    mRowsAdapter = new ArrayObjectAdapter(ps);
    mRowsAdapter.clear();
    // Add all the non-null rows
    for (Row row : new Row[] {mDetailsRow, mPlotAndGenresRow, mCastRow, mPostersRow, mBackdropsRow, mWebLinksRow}) {
        if (row!=null) {
            mRowsAdapter.add(row);
        }
    }
    setAdapter(mRowsAdapter);
}
 
開發者ID:archos-sa,項目名稱:aos-Video,代碼行數:19,代碼來源:TvshowMoreDetailsFragment.java

示例7: onBindViewHolder

import android.support.v17.leanback.widget.ListRow; //導入依賴的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

示例8: onRecordedProgramsRemoved

import android.support.v17.leanback.widget.ListRow; //導入依賴的package包/類
@Override
public void onRecordedProgramsRemoved(RecordedProgram... recordedPrograms) {
    for (RecordedProgram recordedProgram : recordedPrograms) {
        if (TextUtils.equals(recordedProgram.getSeriesId(), mSeries.getSeriesId())) {
            ListRow row = getSeasonRow(recordedProgram.getSeasonNumber(), false);
            if (row != null) {
                SeasonRowAdapter adapter = (SeasonRowAdapter) row.getAdapter();
                adapter.remove(recordedProgram);
                if (adapter.isEmpty()) {
                    getRowsAdapter().remove(row);
                    if (getRowsAdapter().size() == 1) {
                        // No season rows left. Only DetailsOverviewRow
                        mActionsAdapter.clear(ACTION_DELETE);
                    }
                }
            }
            if (recordedProgram.getId() == mRecommendRecordedProgram.getId()) {
                updateWatchAction();
            }
        }
    }
}
 
開發者ID:trevd,項目名稱:android_packages_apps_tv,代碼行數:23,代碼來源:SeriesRecordingDetailsFragment.java

示例9: getSeasonRow

import android.support.v17.leanback.widget.ListRow; //導入依賴的package包/類
private ListRow getSeasonRow(String seasonNumber, boolean createNewRow) {
    seasonNumber = TextUtils.isEmpty(seasonNumber) ? "" : seasonNumber;
    ArrayObjectAdapter rowsAdaptor = getRowsAdapter();
    for (int i = rowsAdaptor.size() - 1; i >= 0; i--) {
        Object row = rowsAdaptor.get(i);
        if (row instanceof ListRow) {
            int compareResult = BaseProgram.numberCompare(seasonNumber,
                    ((SeasonRowAdapter) ((ListRow) row).getAdapter()).mSeasonNumber);
            if (compareResult == 0) {
                return (ListRow) row;
            } else if (compareResult < 0) {
                return createNewRow ? createNewSeasonRow(seasonNumber, i + 1) : null;
            }
        }
    }
    return createNewRow ? createNewSeasonRow(seasonNumber, rowsAdaptor.size()) : null;
}
 
開發者ID:trevd,項目名稱:android_packages_apps_tv,代碼行數:18,代碼來源:SeriesRecordingDetailsFragment.java

示例10: createNewSeasonRow

import android.support.v17.leanback.widget.ListRow; //導入依賴的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

示例11: setupMoreMovies

import android.support.v17.leanback.widget.ListRow; //導入依賴的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

示例12: setupMoreTVShows

import android.support.v17.leanback.widget.ListRow; //導入依賴的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

示例13: updateRelatedEpisodes

import android.support.v17.leanback.widget.ListRow; //導入依賴的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: onLoadFinished

import android.support.v17.leanback.widget.ListRow; //導入依賴的package包/類
@Override
public void onLoadFinished(Loader<List<Category>> loader, List<Category> data) {
  Log.d(TAG, "onLoadFinished");
  LoadingHelper.hideLoading(this);
  rows.clear();
  if (data == null) {
    Log.w(TAG, "No data returned by loader");
    createSettingsRow();
    return;
  }
  for (Category category : data) {
    ListRow categoryRow = createCategoryRow(category);
    rows.add(categoryRow);
  }
  createSettingsRow();
}
 
開發者ID:mkjensen,項目名稱:danish-media-license,代碼行數:17,代碼來源:BrowseFragment.java

示例15: init

import android.support.v17.leanback.widget.ListRow; //導入依賴的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


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