当前位置: 首页>>代码示例>>Java>>正文


Java ClassPresenterSelector类代码示例

本文整理汇总了Java中android.support.v17.leanback.widget.ClassPresenterSelector的典型用法代码示例。如果您正苦于以下问题:Java ClassPresenterSelector类的具体用法?Java ClassPresenterSelector怎么用?Java ClassPresenterSelector使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ClassPresenterSelector类属于android.support.v17.leanback.widget包,在下文中一共展示了ClassPresenterSelector类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onCreate

import android.support.v17.leanback.widget.ClassPresenterSelector; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
    Log.d(TAG, "onCreate DetailsFragment");
    super.onCreate(savedInstanceState);

    mDetailsBackground = new DetailsFragmentBackgroundController(this);

    mSelectedMovie =
            (Movie) getActivity().getIntent().getSerializableExtra(DetailsActivity.MOVIE);
    if (mSelectedMovie != null) {
        mPresenterSelector = new ClassPresenterSelector();
        mAdapter = new ArrayObjectAdapter(mPresenterSelector);
        setupDetailsOverviewRow();
        setupDetailsOverviewRowPresenter();
        setupRelatedMovieListRow();
        setAdapter(mAdapter);
        initializeBackground(mSelectedMovie);
        setOnItemViewClickedListener(new ItemViewClickedListener());
    } else {
        Intent intent = new Intent(getActivity(), MainActivity.class);
        startActivity(intent);
    }
}
 
开发者ID:alphater,项目名称:garras,代码行数:24,代码来源:VideoDetailsFragment.java

示例2: buildFilePresenter

import android.support.v17.leanback.widget.ClassPresenterSelector; //导入依赖的package包/类
private ClassPresenterSelector buildFilePresenter() {
    ClassPresenterSelector filePresenterSelector = new ClassPresenterSelector();
    switch (mDisplayMode) {
        case GRID:
            filePresenterSelector.addClassPresenter(MetaFile2.class, new PosterImageCardPresenter(getActivity()));
            filePresenterSelector.addClassPresenter(Video.class, new PosterImageCardPresenter(getActivity()));
            break;
        case LIST:
            filePresenterSelector.addClassPresenter(MetaFile2.class, new MetaFileListPresenter());
            filePresenterSelector.addClassPresenter(Video.class, new VideoListPresenter(true));
            break;
        default:
            throw new IllegalArgumentException("Invalid Display Mode! "+mDisplayMode);
    }
    return filePresenterSelector;
}
 
开发者ID:archos-sa,项目名称:aos-Video,代码行数:17,代码来源:ListingFragment.java

示例3: onPostExecute

import android.support.v17.leanback.widget.ClassPresenterSelector; //导入依赖的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

示例4: createNewSeasonRow

import android.support.v17.leanback.widget.ClassPresenterSelector; //导入依赖的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

示例5: initializeRelatedVideosRow

import android.support.v17.leanback.widget.ClassPresenterSelector; //导入依赖的package包/类
private ArrayObjectAdapter initializeRelatedVideosRow() {
    /*
     * To add a new row to the mPlayerAdapter and not lose the controls row that is provided by the
     * glue, we need to compose a new row with the controls row and our related videos row.
     *
     * We start by creating a new {@link ClassPresenterSelector}. Then add the controls row from
     * the media player glue, then add the related videos row.
     */
    ClassPresenterSelector presenterSelector = new ClassPresenterSelector();
    presenterSelector.addClassPresenter(
            mPlayerGlue.getControlsRow().getClass(), mPlayerGlue.getPlaybackRowPresenter());
    presenterSelector.addClassPresenter(ListRow.class, new ListRowPresenter());

    ArrayObjectAdapter rowsAdapter = new ArrayObjectAdapter(presenterSelector);

    rowsAdapter.add(mPlayerGlue.getControlsRow());

    HeaderItem header = new HeaderItem(getString(R.string.related_movies));
    ListRow row = new ListRow(header, mVideoCursorAdapter);
    rowsAdapter.add(row);

    setOnItemViewClickedListener(new ItemViewClickedListener());

    return rowsAdapter;
}
 
开发者ID:googlesamples,项目名称:androidtv-Leanback,代码行数:26,代码来源:PlaybackFragment.java

示例6: buildAboutAdapter

import android.support.v17.leanback.widget.ClassPresenterSelector; //导入依赖的package包/类
private ArrayObjectAdapter buildAboutAdapter() {
    DetailsOverviewRowPresenter rowPresenter = new DetailsOverviewRowPresenter(new AboutDetailsDescriptionPresenter());
    rowPresenter.setBackgroundColor(getResources().getColor(R.color.about_background));
    rowPresenter.setOnActionClickedListener(new OnActionClickedListener() {

        @Override
        public void onActionClicked(Action action) {}
    });

    ClassPresenterSelector selector = new ClassPresenterSelector();
    selector.addClassPresenter(DetailsOverviewRow.class, rowPresenter);
    selector.addClassPresenter(ListRow.class, new ListRowPresenter());

    ArrayObjectAdapter rowsAdapter = new ArrayObjectAdapter(selector);

    rowsAdapter.add(generateAboutMeRow());
    rowsAdapter.add(generateAboutGDGRow());

    return rowsAdapter;
}
 
开发者ID:wildsmith,项目名称:TickTank_old,代码行数:21,代码来源:AboutDetailsFragment.java

示例7: onStart

import android.support.v17.leanback.widget.ClassPresenterSelector; //导入依赖的package包/类
@Override
public void onStart() {
    super.onStart();

    // Set up UI
    Video video = getActivity().getIntent().getParcelableExtra(VideoDetailsActivity.VIDEO);
    if (!updateSelectedVideo(video)) {
        return;
    }

    mGlue = new PlaybackControlHelper(getActivity(), this, mSelectedVideo);
    PlaybackControlsRowPresenter controlsRowPresenter = mGlue.createControlsRowAndPresenter();
    PlaybackControlsRow controlsRow = mGlue.getControlsRow();
    mMediaControllerCallback = mGlue.createMediaControllerCallback();

    mMediaController = getActivity().getMediaController();
    mMediaController.registerCallback(mMediaControllerCallback);

    ClassPresenterSelector ps = new ClassPresenterSelector();
    ps.addClassPresenter(PlaybackControlsRow.class, controlsRowPresenter);
    ps.addClassPresenter(ListRow.class, new ListRowPresenter());
    mRowsAdapter = new ArrayObjectAdapter(ps);
    mRowsAdapter.add(controlsRow);
    addOtherRows();
    updatePlaybackRow();
    setAdapter(mRowsAdapter);

    startPlaying();
}
 
开发者ID:nejtv,项目名称:androidtv-sample,代码行数:30,代码来源:PlaybackOverlayFragment.java

示例8: setupAdapter

import android.support.v17.leanback.widget.ClassPresenterSelector; //导入依赖的package包/类
private void setupAdapter() {
    // Set detail background and style.
    FullWidthDetailsOverviewRowPresenter detailsPresenter =
            new FullWidthDetailsOverviewRowPresenter(new DetailsDescriptionPresenter(),
                    new MovieDetailsOverviewLogoPresenter());

    detailsPresenter.setBackgroundColor(
            ContextCompat.getColor(getActivity(), R.color.selected_background));
    detailsPresenter.setInitialState(FullWidthDetailsOverviewRowPresenter.STATE_HALF);

    // Hook up transition element.
    mHelper = new FullWidthDetailsOverviewSharedElementHelper();
    mHelper.setSharedElementEnterTransition(getActivity(),
            VideoDetailsActivity.SHARED_ELEMENT_NAME);
    detailsPresenter.setListener(mHelper);
    detailsPresenter.setParticipatingEntranceTransition(false);
    prepareEntranceTransition();

    detailsPresenter.setOnActionClickedListener(new OnActionClickedListener() {
        @Override
        public void onActionClicked(Action action) {
            if (action.getId() == ACTION_WATCH_TRAILER) {
                Intent intent = new Intent(getActivity(), PlaybackOverlayActivity.class);
                intent.putExtra(VideoDetailsActivity.VIDEO, mSelectedVideo);
                startActivity(intent);
            } else {
                Toast.makeText(getActivity(), action.toString(), Toast.LENGTH_SHORT).show();
            }
        }
    });

    mPresenterSelector = new ClassPresenterSelector();
    mPresenterSelector.addClassPresenter(DetailsOverviewRow.class, detailsPresenter);
    mPresenterSelector.addClassPresenter(ListRow.class, new ListRowPresenter());
    mAdapter = new ArrayObjectAdapter(mPresenterSelector);
    setAdapter(mAdapter);
}
 
开发者ID:nejtv,项目名称:androidtv-sample,代码行数:38,代码来源:VideoDetailsFragment.java

示例9: onCreate

import android.support.v17.leanback.widget.ClassPresenterSelector; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    mScraper = new Scraper(getActivity());
    mSearchExecutor = new SerialExecutor();

    ClassPresenterSelector rowsPresenterSelector = new ClassPresenterSelector();
    rowsPresenterSelector.addClassPresenter(ListRow.class, new ListRowPresenter());
    rowsPresenterSelector.addClassPresenter(ShadowLessListRow.class, new ShadowLessRowPresenter());
    mRowsAdapter = new ArrayObjectAdapter(rowsPresenterSelector);

    setBadgeDrawable(getResources().getDrawable(R.mipmap.video2));
    setSearchResultProvider(this);
    setOnItemViewClickedListener(new OnItemViewClickedListener() {
        @Override
        public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item, RowPresenter.ViewHolder rowViewHolder, Row row) {
            if (item instanceof BaseTags) {
                saveTagsAndFinish((BaseTags) item);
            }
        }
    });
    mSpeechRecognitionCallback = new SpeechRecognitionCallback() {

        @Override
        public void recognizeSpeech() {

            // ACTION_RECOGNIZE_SPEECH
            try{
                startActivityForResult(getRecognizerIntent(), SEARCH_REQUEST_CODE);
            }catch (ActivityNotFoundException e){/*non google device*/}
        }
    };
    setSpeechRecognitionCallback(mSpeechRecognitionCallback);
}
 
开发者ID:archos-sa,项目名称:aos-Video,代码行数:36,代码来源:ManualScrappingSearchFragment.java

示例10: updateRow

import android.support.v17.leanback.widget.ClassPresenterSelector; //导入依赖的package包/类
private void updateRow(){
    if ((mSearchResults==null||mSearchResults.isEmpty())&&mNfoTags==null) {
        ArrayObjectAdapter listRowAdapter = new ArrayObjectAdapter(new EmptyViewPresenter());
        listRowAdapter.add(new EmptyView(getEmptyText()));
        mRowsAdapter.clear();
        mRowsAdapter.add(new ShadowLessListRow(new HeaderItem(getString(R.string.search_results)), listRowAdapter));
    }
    else {
        // Prepare the result list widget
        ClassPresenterSelector classPresenter = new ClassPresenterSelector();
        classPresenter.addClassPresenter(SearchResult.class, new ScraperSearchResultPresenter()); // for initial search result
        classPresenter.addClassPresenter(BaseTags.class, new ScraperBaseTagsPresenter()); // for detailed result info


        mResultsAdapter = new ArrayObjectAdapter(classPresenter);
        if(mNfoTags!=null) {
            mResultsAdapter.add(0, mNfoTags);
            mOffset=1;
        }
        if(mSearchResults!=null)
            mResultsAdapter.addAll(mOffset, mSearchResults);
        ListRow listRow = new ListRow(new HeaderItem(getResultsHeaderText()), mResultsAdapter);

        mRowsAdapter.clear();
        mRowsAdapter.add(listRow);
        if(mSearchResults!=null) {
            // Launch the details task to get posters, etc.
            SearchResult[] array = mSearchResults.toArray(new SearchResult[mSearchResults.size()]);
            mDetailsTask = new ScraperDetailsFetchTask().executeOnExecutor(mSearchExecutor,array);
        }
    }
}
 
开发者ID:archos-sa,项目名称:aos-Video,代码行数:33,代码来源:ManualScrappingSearchFragment.java

示例11: loadRows

import android.support.v17.leanback.widget.ClassPresenterSelector; //导入依赖的package包/类
private void loadRows() {
    mRowsAdapter = new ArrayObjectAdapter(new ListRowPresenter());

    ClassPresenterSelector classPresenter = new ClassPresenterSelector();
    classPresenter.addClassPresenter(NetworkShortcut.class, new NetworkShortcutPresenter());
    classPresenter.addClassPresenter(Box.class, new RescanBoxItemPresenter()); // for the rescan item
    mIndexedFoldersAdapter = new ArrayObjectAdapter(classPresenter);
    mIndexedFoldersListRow = new ListRow(
            new HeaderItem(getString(R.string.indexed_folders)),
            mIndexedFoldersAdapter);
    mRowsAdapter.add(mIndexedFoldersListRow);

    mSmbDiscoveryAdapter = new ArrayObjectAdapter(new SmbSharePresenter());
    mRowsAdapter.add(new ListRow(
            new HeaderItem(getString(R.string.network_shared_folders)),
            mSmbDiscoveryAdapter));
    if(UpnpAvailability.isUpnpAvaialbe()) {
        mUpnpDiscoveryAdapter = new ArrayObjectAdapter(new SmbSharePresenter());
        mRowsAdapter.add(new ListRow(
                new HeaderItem(getString(R.string.network_media_servers)),
                mUpnpDiscoveryAdapter));
    }

    mFtpShortcutsAdapter = new ArrayObjectAdapter(new NetworkShortcutPresenter());
    mRowsAdapter.add(new ListRow(
            new HeaderItem(getString(R.string.ftp_shortcuts)),
            mFtpShortcutsAdapter));

    setOnItemViewClickedListener(mClickListener);

    setAdapter(mRowsAdapter);
}
 
开发者ID:archos-sa,项目名称:aos-Video,代码行数:33,代码来源:NetworkRootFragment.java

示例12: onStart

import android.support.v17.leanback.widget.ClassPresenterSelector; //导入依赖的package包/类
@Override
    public void onStart() {
        super.onStart();

        // Set up UI
        Video video = getActivity().getIntent().getParcelableExtra(VideoDetailsActivity.VIDEO);
        if (!updateSelectedVideo(video)) {
            return;
        }

        mGlue = new PlaybackControlHelper(getActivity(), this, mSelectedVideo);
        PlaybackControlsRowPresenter controlsRowPresenter = mGlue.createControlsRowAndPresenter();
        PlaybackControlsRow controlsRow = mGlue.getControlsRow();
        mMediaControllerCallback = mGlue.createMediaControllerCallback();
//
        mMediaController = getActivity().getMediaController();
        mMediaController.registerCallback(mMediaControllerCallback);
//
        ClassPresenterSelector ps = new ClassPresenterSelector();
        ps.addClassPresenter(PlaybackControlsRow.class, controlsRowPresenter);
        ps.addClassPresenter(ListRow.class, new ListRowPresenter());
        mRowsAdapter = new ArrayObjectAdapter(ps);
        mRowsAdapter.add(controlsRow);
        addOtherRows();
        updatePlaybackRow();
        setAdapter(mRowsAdapter);


        startPlaying();

    }
 
开发者ID:ad-on-is,项目名称:chilly,代码行数:32,代码来源:PlaybackOverlayFragment.java

示例13: setupAdapter

import android.support.v17.leanback.widget.ClassPresenterSelector; //导入依赖的package包/类
private void setupAdapter() {
    FullWidthDetailsOverviewRowPresenter detailsPresenter =
            new FullWidthDetailsOverviewRowPresenter(
                    new DetailsDescriptionPresenter(), new MovieDetailsOverviewLogoPresenter());

    detailsPresenter.setBackgroundColor(
            ContextCompat.getColor(getContext(), R.color.background_dark));
    detailsPresenter.setInitialState(FullWidthDetailsOverviewRowPresenter.STATE_HALF);

    detailsPresenter.setOnActionClickedListener(
            new OnActionClickedListener() {
                @Override
                public void onActionClicked(Action action) {
                    if (action.getId() == ACTION_WATCH) {
                        Intent intent =
                                PlaybackActivity.createIntent(getContext(), mMovie.getId());
                        startActivity(intent);
                    } else {
                        Toast.makeText(getActivity(), action.toString(), Toast.LENGTH_SHORT)
                                .show();
                    }
                }
            });

    ClassPresenterSelector mPresenterSelector = new ClassPresenterSelector();
    mPresenterSelector.addClassPresenter(DetailsOverviewRow.class, detailsPresenter);
    mAdapter = new ArrayObjectAdapter(mPresenterSelector);
    setAdapter(mAdapter);
}
 
开发者ID:googlesamples,项目名称:leanback-assistant,代码行数:30,代码来源:VideoDetailsFragment.java

示例14: setUpRows

import android.support.v17.leanback.widget.ClassPresenterSelector; //导入依赖的package包/类
private void setUpRows() {
    PlaybackControlsRowPresenter controlsRowPresenter =
            mPlaybackControlHelper.createControlsRowAndPresenter();

    ClassPresenterSelector selector = new ClassPresenterSelector();
    selector.addClassPresenter(PlaybackControlsRow.class, controlsRowPresenter);
    selector.addClassPresenter(ListRow.class, new ListRowPresenter());

    mRowsAdapter = new ArrayObjectAdapter(selector);
    mRowsAdapter.add(mPlaybackControlHelper.getControlsRow());
    mRelatedRecordingsRow = getRelatedRecordingsRow();
    setAdapter(mRowsAdapter);
}
 
开发者ID:trevd,项目名称:android_packages_apps_tv,代码行数:14,代码来源:DvrPlaybackOverlayFragment.java

示例15: onCreatePresenterSelector

import android.support.v17.leanback.widget.ClassPresenterSelector; //导入依赖的package包/类
@Override
protected PresenterSelector onCreatePresenterSelector(
        DetailsOverviewRowPresenter rowPresenter) {
    ClassPresenterSelector presenterSelector = new ClassPresenterSelector();
    presenterSelector.addClassPresenter(DetailsOverviewRow.class, rowPresenter);
    presenterSelector.addClassPresenter(ListRow.class, new ListRowPresenter());
    return presenterSelector;
}
 
开发者ID:trevd,项目名称:android_packages_apps_tv,代码行数:9,代码来源:SeriesRecordingDetailsFragment.java


注:本文中的android.support.v17.leanback.widget.ClassPresenterSelector类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。