Java 类android.support.v17.leanback.widget.RowHeaderPresenter 实例源码

项目:aos-Video    文件:MoviesByFragment.java   
@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    mPrefs = PreferenceManager.getDefaultSharedPreferences(getActivity());
    mSortOrder = mPrefs.getString(getSortOrderParamKey(), MoviesLoader.DEFAULT_SORT);

    Resources r = getResources();
    BackgroundManager bgMngr = BackgroundManager.getInstance(getActivity());
    bgMngr.attach(getActivity().getWindow());
    bgMngr.setColor(r.getColor(R.color.leanback_background));

    setHeadersState(HEADERS_ENABLED);
    setHeadersTransitionOnBackEnabled(true);

    // set fastLane (or headers) background color
    setBrandColor(r.getColor(R.color.leanback_side));

    // set search icon color
    setSearchAffordanceColor(r.getColor(R.color.lightblueA200));

    setupEventListeners();

    RowPresenter rowPresenter = new ListRowPresenter();
    rowPresenter.setHeaderPresenter(new RowHeaderPresenter());
    mRowsAdapter = new ArrayObjectAdapter(rowPresenter);
    setAdapter(mRowsAdapter);

    mVideoPresenter = new PosterImageCardPresenter(getActivity());
    mVideoMapper = new CompatibleCursorMapperConverter(new VideoCursorMapper());

    getLoaderManager().initLoader(-1, null, this);
}
项目:aos-Video    文件:VideosByFragment.java   
@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    mPrefs = PreferenceManager.getDefaultSharedPreferences(getActivity());
    mSortOrder = mPrefs.getString(getSortOrderParamKey(), MoviesLoader.DEFAULT_SORT);

    Resources r = getResources();
    BackgroundManager bgMngr = BackgroundManager.getInstance(getActivity());
    bgMngr.attach(getActivity().getWindow());
    bgMngr.setColor(r.getColor(R.color.leanback_background));

    setHeadersState(HEADERS_ENABLED);
    setHeadersTransitionOnBackEnabled(true);

    // set fastLane (or headers) background color
    setBrandColor(r.getColor(R.color.leanback_side));

    // set search icon color
    setSearchAffordanceColor(r.getColor(R.color.lightblueA200));

    setupEventListeners();

    RowPresenter rowPresenter = new ListRowPresenter();
    rowPresenter.setHeaderPresenter(new RowHeaderPresenter());
    mRowsAdapter = new ArrayObjectAdapter(rowPresenter);
    setAdapter(mRowsAdapter);

    mVideoPresenter = new PosterImageCardPresenter(getActivity());
    mVideoMapper = new CompatibleCursorMapperConverter(new VideoCursorMapper());

    getLoaderManager().initLoader(-1, null, this);
}
项目:androidtv-sample    文件:IconHeaderItemPresenter.java   
@Override
protected void onSelectLevelChanged(RowHeaderPresenter.ViewHolder holder) {
    holder.view.setAlpha(mUnselectedAlpha + holder.getSelectLevel() *
            (1.0f - mUnselectedAlpha));
}
项目:aos-Video    文件:MainFragment.java   
private void loadRows() {
    Log.d(TAG,"loadRows()");
    // Two different row presenters, one standard for regular cards, one special for the icon items
    ListRowPresenter listRowPresenter = new ListRowPresenter();
    IconItemRowPresenter iconItemRowPresenter = new IconItemRowPresenter();

    // Only way I found to use two different presenter is using a ClassPresenterSelector, hence i needed
    // to create a dummy IconListRow that does nothing more than a regular ListRow
    ClassPresenterSelector rowsPresenterSelector = new ClassPresenterSelector();
    rowsPresenterSelector.addClassPresenter(ListRow.class, listRowPresenter);
    rowsPresenterSelector.addClassPresenter(IconListRow.class, iconItemRowPresenter);

    // Basic header presenter for both row presenters
    listRowPresenter.setHeaderPresenter(new RowHeaderPresenter());
    iconItemRowPresenter.setHeaderPresenter(new RowHeaderPresenter());

    mRowsAdapter = new ArrayObjectAdapter(rowsPresenterSelector);

    mLastAddedAdapter = new CursorObjectAdapter(new PosterImageCardPresenter(getActivity()));
    mLastAddedAdapter.setMapper(new CompatibleCursorMapperConverter(new VideoCursorMapper()));
    mLastAddedRow = new ListRow(ROW_ID_LAST_ADDED, new HeaderItem(getString(R.string.recently_added)), mLastAddedAdapter);
    mRowsAdapter.add(mLastAddedRow);

    mLastPlayedAdapter = new CursorObjectAdapter(new PosterImageCardPresenter(getActivity()));
    mLastPlayedAdapter.setMapper(new CompatibleCursorMapperConverter(new VideoCursorMapper()));
    mLastPlayedRow = new ListRow(ROW_ID_LAST_PLAYED, new HeaderItem(getString(R.string.recently_played)), mLastPlayedAdapter);
    mRowsAdapter.add(mLastPlayedRow);

    ArrayObjectAdapter movieRowAdapter = new ArrayObjectAdapter(new BoxItemPresenter());
    movieRowAdapter.add(buildAllMoviesBox());
    movieRowAdapter.add(new Box(Box.ID.MOVIES_BY_GENRE, getString(R.string.movies_by_genre), R.drawable.genres_banner));
    movieRowAdapter.add(new Box(Box.ID.MOVIES_BY_YEAR, getString(R.string.movies_by_year), R.drawable.years_banner));
    mRowsAdapter.add(new ListRow(ROW_ID_MOVIES,
            new HeaderItem(getString(R.string.movies)),
            movieRowAdapter));

    mTvshowsAdapter = new CursorObjectAdapter(new PosterImageCardPresenter(getActivity()));
    mTvshowsAdapter.setMapper(new CompatibleCursorMapperConverter(new TvshowCursorMapper()));
    mTvshowsRow = new ListRow(ROW_ID_TVSHOWS, new HeaderItem(getString(R.string.all_tv_shows)), mTvshowsAdapter);
    mRowsAdapter.add(mTvshowsRow);

    mFileBrowsingRowAdapter = new ArrayObjectAdapter(new BoxItemPresenter());
    mFileBrowsingRowAdapter.add(new Box(Box.ID.NETWORK, getString(R.string.network_storage), R.drawable.filetype_new_server));
    mFileBrowsingRowAdapter.add(new Box(Box.ID.FOLDERS, getString(R.string.internal_storage), R.drawable.filetype_new_folder));
    mFileBrowsingRowAdapter.add(new Box(Box.ID.VIDEOS_BY_LISTS, getString(R.string.video_lists), R.drawable.filetype_new_playlist));

    mNonScrapedVideosItem = new Box(Box.ID.NON_SCRAPED_VIDEOS, getString(R.string.non_scraped_videos), R.drawable.filetype_new_unscraped_video);
    // Add USB and SDcard items at init ?depending of their availability
    updateUsbAndSdcardVisibility();

    mRowsAdapter.add(new ListRow(ROW_ID_FILES,
            new HeaderItem(getString(R.string.leanback_browsing)),
            mFileBrowsingRowAdapter));

    mPreferencesRowAdapter = new ArrayObjectAdapter(new IconItemPresenter());
    mPreferencesRowAdapter.add(new Icon(Icon.ID.PREFERENCES, getString(R.string.preferences), R.drawable.lollipop_settings));
    mPreferencesRowAdapter.add(new Icon(Icon.ID.PRIVATE_MODE, getString(R.string.private_mode_is_on), getString(R.string.private_mode_is_off),
                                        R.drawable.private_mode,  R.drawable.private_mode_off, PrivateMode.isActive()));
    mPreferencesRowAdapter.add(new Icon(Icon.ID.LEGACY_UI, getString(R.string.leanback_legacy_ui), R.drawable.legacy_ui_icon));
    mPreferencesRowAdapter.add(new Icon(Icon.ID.HELP_FAQ, getString(R.string.help_faq), R.drawable.lollipop_help));

    // Must use an IconListRow to have the dedicated presenter used (see ClassPresenterSelector above)
    mRowsAdapter.add(new IconListRow(ROW_ID_PREFERENCES,
            new HeaderItem(getString(R.string.preferences)),
            mPreferencesRowAdapter));

    setAdapter(mRowsAdapter);
}
项目:aos-Video    文件:FullTextRowPresenter.java   
public FullTextRowPresenter() {
    super();
    mMaxLines = -1;
    setHeaderPresenter(new RowHeaderPresenter());
}
项目:aos-Video    文件:FullTextRowPresenter.java   
public FullTextRowPresenter(int maxLines, int color) {
    super();
    mMaxLines = maxLines;
    mColor = color;
    setHeaderPresenter(new RowHeaderPresenter());
}
项目:aos-Video    文件:SubtitlesDetailsRowPresenter.java   
public SubtitlesDetailsRowPresenter(SubtitleDownloadInterface subtitleDownloadInterface, int color) {
    super();
    mColor = color;
    mSubtitleDownloadInterface = subtitleDownloadInterface;
    setHeaderPresenter(new RowHeaderPresenter());
}
项目:aos-Video    文件:FileDetailsRowPresenter.java   
public FileDetailsRowPresenter(int color) {
    super();
    mColor = color;
    setHeaderPresenter(new RowHeaderPresenter());
}
项目:aos-Video    文件:PlotAndGenresRowPresenter.java   
public PlotAndGenresRowPresenter() {
    super();
    mMaxLines = -1;
    setHeaderPresenter(new RowHeaderPresenter());
}
项目:aos-Video    文件:PlotAndGenresRowPresenter.java   
public PlotAndGenresRowPresenter(int maxLines, int color) {
    super();
    mColor = color;
    mMaxLines = maxLines;
    setHeaderPresenter(new RowHeaderPresenter());
}
项目:aos-Video    文件:CastRowPresenter.java   
public CastRowPresenter() {
    super();
    mMaxLines = -1;
    setHeaderPresenter(new RowHeaderPresenter());
}
项目:aos-Video    文件:CastRowPresenter.java   
public CastRowPresenter(int maxLines, int color) {
    super();
    mColor = color;
    mMaxLines = maxLines;
    setHeaderPresenter(new RowHeaderPresenter());
}
项目:chilly    文件:IconHeaderItemPresenter.java   
@Override
protected void onSelectLevelChanged(RowHeaderPresenter.ViewHolder holder) {
    holder.view.setAlpha(mUnselectedAlpha + holder.getSelectLevel() *
            (1.0f - mUnselectedAlpha));
}
项目:LeanbackCards    文件:HeaderItemPresenter.java   
@Override
protected void onSelectLevelChanged(RowHeaderPresenter.ViewHolder holder) {
    // this is a temporary fix
    holder.view.setAlpha(mUnselectedAlpha + holder.getSelectLevel() *
            (1.0f - mUnselectedAlpha));
}
项目:Vineyard    文件:IconHeaderItemPresenter.java   
@Override
protected void onSelectLevelChanged(RowHeaderPresenter.ViewHolder holder) {
    // this is a temporary fix
    holder.view.setAlpha(mUnselectedAlpha + holder.getSelectLevel() *
            (1.0f - mUnselectedAlpha));
}
项目:androidtv-Leanback    文件:IconHeaderItemPresenter.java   
@Override
protected void onSelectLevelChanged(RowHeaderPresenter.ViewHolder holder) {
    holder.view.setAlpha(mUnselectedAlpha + holder.getSelectLevel() *
            (1.0f - mUnselectedAlpha));
}
项目:BuildingForAndroidTV    文件:IconHeaderItemPresenter.java   
@Override
protected void onSelectLevelChanged(RowHeaderPresenter.ViewHolder holder) {
    // this is a temporary fix
    holder.view.setAlpha(mUnselectedAlpha + holder.getSelectLevel() *
            (1.0f - mUnselectedAlpha));
}