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

项目:chaosflix-leanback    文件:OverlayFragment.java   
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);
}
项目:HelloTV    文件:VideoDetailsFragment.java   
@Override
public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item,
                          RowPresenter.ViewHolder rowViewHolder, Row row) {

    if (item instanceof Movie) {
        Movie movie = (Movie) item;
        Log.d(TAG, "Item: " + item.toString());
        Intent intent = new Intent(getActivity(), DetailsActivity.class);
        intent.putExtra(getResources().getString(R.string.movie), mSelectedMovie);
        intent.putExtra(getResources().getString(R.string.should_start), true);
        startActivity(intent);


        Bundle bundle = ActivityOptionsCompat.makeSceneTransitionAnimation(
                getActivity(),
                ((ImageCardView) itemViewHolder.view).getMainImageView(),
                DetailsActivity.SHARED_ELEMENT_NAME).toBundle();
        getActivity().startActivity(intent, bundle);
    }
}
项目:garras    文件:VideoDetailsFragment.java   
@Override
public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item,
                          RowPresenter.ViewHolder rowViewHolder, Row row) {

    if (item instanceof Movie) {
        Log.d(TAG, "Item: " + item.toString());
        Intent intent = new Intent(getActivity(), DetailsActivity.class);
        intent.putExtra(getResources().getString(R.string.movie), mSelectedMovie);

        Bundle bundle = ActivityOptionsCompat.makeSceneTransitionAnimation(
                getActivity(),
                ((ImageCardView) itemViewHolder.view).getMainImageView(),
                DetailsActivity.SHARED_ELEMENT_NAME).toBundle();
        getActivity().startActivity(intent, bundle);
    }
}
项目:tubik    文件:VideoDetailsFragment.java   
@Override
public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item,
                          RowPresenter.ViewHolder rowViewHolder, Row row) {

    if (item instanceof Movie) {
        Movie movie = (Movie) item;
        Log.d(TAG, "Item: " + item.toString());
        Intent intent = new Intent(getActivity(), DetailsActivity.class);
        intent.putExtra(getResources().getString(R.string.movie), mSelectedMovie);
        intent.putExtra(getResources().getString(R.string.should_start), true);
        startActivity(intent);


        Bundle bundle = ActivityOptionsCompat.makeSceneTransitionAnimation(
                getActivity(),
                ((ImageCardView) itemViewHolder.view).getMainImageView(),
                DetailsActivity.SHARED_ELEMENT_NAME).toBundle();
        getActivity().startActivity(intent, bundle);
    }
}
项目:androidtv-sample    文件:PlaybackOverlayFragment.java   
@Override
public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item,
                          RowPresenter.ViewHolder rowViewHolder, Row row) {

    if (item instanceof Video) {
        Video video = (Video) item;
        Intent intent = new Intent(getActivity(), PlaybackOverlayActivity.class);
        intent.putExtra(VideoDetailsActivity.VIDEO, video);

        Bundle bundle = ActivityOptionsCompat.makeSceneTransitionAnimation(
                getActivity(),
                ((ImageCardView) itemViewHolder.view).getMainImageView(),
                VideoDetailsActivity.SHARED_ELEMENT_NAME).toBundle();
        getActivity().startActivity(intent, bundle);
    }
}
项目:androidtv-sample    文件:VideoDetailsFragment.java   
@Override
public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item,
                          RowPresenter.ViewHolder rowViewHolder, Row row) {

    if (item instanceof Video) {
        Video video = (Video) item;
        Intent intent = new Intent(getActivity(), VideoDetailsActivity.class);
        intent.putExtra(VideoDetailsActivity.VIDEO, video);

        Bundle bundle = ActivityOptionsCompat.makeSceneTransitionAnimation(
                getActivity(),
                ((ImageCardView) itemViewHolder.view).getMainImageView(),
                VideoDetailsActivity.SHARED_ELEMENT_NAME).toBundle();
        getActivity().startActivity(intent, bundle);
    }
}
项目:androidtv-sample    文件:SearchFragment.java   
@Override
public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item,
                          RowPresenter.ViewHolder rowViewHolder, Row row) {

    if (item instanceof Video) {
        Video video = (Video) item;
        Intent intent = new Intent(getActivity(), VideoDetailsActivity.class);
        intent.putExtra(VideoDetailsActivity.VIDEO, video);

        Bundle bundle = ActivityOptionsCompat.makeSceneTransitionAnimation(
                getActivity(),
                ((ImageCardView) itemViewHolder.view).getMainImageView(),
                VideoDetailsActivity.SHARED_ELEMENT_NAME).toBundle();
        getActivity().startActivity(intent, bundle);
    } else {
        Toast.makeText(getActivity(), ((String) item), Toast.LENGTH_SHORT).show();
    }
}
项目:androidtv-sample    文件:VerticalGridFragment.java   
@Override
public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item,
                          RowPresenter.ViewHolder rowViewHolder, Row row) {

    if (item instanceof Video) {
        Video video = (Video) item;

        Intent intent = new Intent(getActivity(), VideoDetailsActivity.class);
        intent.putExtra(VideoDetailsActivity.VIDEO, video);

        Bundle bundle = ActivityOptionsCompat.makeSceneTransitionAnimation(
                getActivity(),
                ((ImageCardView) itemViewHolder.view).getMainImageView(),
                VideoDetailsActivity.SHARED_ELEMENT_NAME).toBundle();
        getActivity().startActivity(intent, bundle);
    }
}
项目:leanback-homescreen-channels    文件:MainFragment.java   
@Override
public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item,
        RowPresenter.ViewHolder rowViewHolder, Row row) {
    if (isAdded()) {
        if (item instanceof Clip) {
            Clip clip = (Clip) item;
            Intent intent = new Intent(getActivity(), PlaybackActivity.class);
            intent.putExtra(PlaybackActivity.EXTRA_CLIP, clip);
            startActivity(intent);
            final long programId = clip.getProgramId();
            if (programId != 0) {
                // This clip is published as a program. Increment the view count for the
                // program to demonstrate updating.
                new SetViewCountInBackground(programId, clip.incrementViewCount());
            }
        }
    }
}
项目:leanback-homescreen-channels    文件:TvSearchFragment.java   
private OnItemViewClickedListener getDefaultItemClickedListener() {
    return new OnItemViewClickedListener() {
        @Override
        public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item,
                RowPresenter.ViewHolder rowViewHolder, Row row) {
            if (item instanceof Clip) {
                Toast.makeText(getActivity(), "** toggle selected **",
                        Toast.LENGTH_LONG).show();
            } else {
                Toast.makeText(getActivity(), "** add as playlist **",
                        Toast.LENGTH_LONG).show();

            }
        }
    };
}
项目:chaosflix    文件:OverlayFragment.java   
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);
}
项目:aos-Video    文件:ListingFragment.java   
protected void setupEventListeners() {
    setOnItemViewClickedListener(new OnItemViewClickedListener() {
        @Override
        public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item, RowPresenter.ViewHolder rowViewHolder, Row row) {
            if (item instanceof MetaFile2) {
                MetaFile2 file = (MetaFile2) item;
                if (file.isDirectory()) {
                    openDirectory(file);
                } else {
                    String mimeType = MimeUtils.guessMimeTypeFromExtension(file.getExtension());
                    PlayUtils.openAnyFile(file, getActivity());

                }
            } else if (item instanceof Video) {
                openDetailsActivity((Video) item, itemViewHolder);
            } else {
                throw new IllegalArgumentException("Click on an unexpected item type " + item);
            }
        }
    });
}
项目:aos-Video    文件:TvshowMoreDetailsFragment.java   
@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);
}
项目:chilly    文件:PlaybackOverlayFragment.java   
@Override
public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item,
        RowPresenter.ViewHolder rowViewHolder, Row row) {

    if (item instanceof Video) {
        Video video = (Video) item;
        Intent intent = new Intent(getActivity(), PlaybackOverlayActivity.class);
        intent.putExtra(VideoDetailsActivity.VIDEO, video);

        Bundle bundle = ActivityOptionsCompat.makeSceneTransitionAnimation(
                getActivity(),
                ((ImageCardView) itemViewHolder.view).getMainImageView(),
                VideoDetailsActivity.SHARED_ELEMENT_NAME).toBundle();
        getActivity().startActivity(intent, bundle);
    }
}
项目:chilly    文件:VerticalGridFragment.java   
@Override
public void onItemSelected(Presenter.ViewHolder itemViewHolder, Object item,
        RowPresenter.ViewHolder rowViewHolder, Row row) {
        Video v = (Video) item;
        long pospage = 40*page;
        if(getPosition() >= pospage-5 && getPosition() <= pospage) {
            if(page < ((pospage/40) + 1)) {
                page++;

                final Handler handler = new Handler();
                handler.postDelayed(new Runnable() {
                    @Override
                    public void run() {
                        // Do something after 5s = 5000ms
                        loadVideos(page);
                    }
                }, 1000);


            }
        }
}
项目:cleaninsights-android-sdk    文件:VideoDetailsFragment.java   
@Override
public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item,
                          RowPresenter.ViewHolder rowViewHolder, Row row) {

    if (item instanceof Movie) {
        Movie movie = (Movie) item;
        Log.d(TAG, "Item: " + item.toString());
        Intent intent = new Intent(getActivity(), DetailsActivity.class);
        intent.putExtra(getResources().getString(R.string.movie), mSelectedMovie);
        intent.putExtra(getResources().getString(R.string.should_start), true);
        startActivity(intent);


        Bundle bundle = ActivityOptionsCompat.makeSceneTransitionAnimation(
                getActivity(),
                ((ImageCardView) itemViewHolder.view).getMainImageView(),
                DetailsActivity.SHARED_ELEMENT_NAME).toBundle();
        getActivity().startActivity(intent, bundle);
    }
}
项目:eanalytics-android    文件:VideoDetailsFragment.java   
@Override
public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item,
                          RowPresenter.ViewHolder rowViewHolder, Row row) {

    if (item instanceof Movie) {
        Movie movie = (Movie) item;
        Log.d(TAG, "Item: " + item.toString());
        Intent intent = new Intent(getActivity(), DetailsActivity.class);
        intent.putExtra(getResources().getString(R.string.movie), mSelectedMovie);
        intent.putExtra(getResources().getString(R.string.should_start), true);
        startActivity(intent);


        Bundle bundle = ActivityOptionsCompat.makeSceneTransitionAnimation(
                getActivity(),
                ((ImageCardView) itemViewHolder.view).getMainImageView(),
                DetailsActivity.SHARED_ELEMENT_NAME).toBundle();
        getActivity().startActivity(intent, bundle);
    }
}
项目:Android-High-Performance-Programming    文件:VideoDetailsFragment.java   
@Override
public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item,
                          RowPresenter.ViewHolder rowViewHolder, Row row) {

    if (item instanceof Movie) {
        Movie movie = (Movie) item;
        Log.d(TAG, "Item: " + item.toString());
        Intent intent = new Intent(getActivity(), DetailsActivity.class);
        intent.putExtra(getResources().getString(R.string.movie), mSelectedMovie);
        intent.putExtra(getResources().getString(R.string.should_start), true);
        startActivity(intent);


        Bundle bundle = ActivityOptionsCompat.makeSceneTransitionAnimation(
                getActivity(),
                ((ImageCardView) itemViewHolder.view).getMainImageView(),
                DetailsActivity.SHARED_ELEMENT_NAME).toBundle();
        getActivity().startActivity(intent, bundle);
    }
}
项目:Android-High-Performance-Programming    文件:VideoDetailsFragment.java   
@Override
public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item,
                          RowPresenter.ViewHolder rowViewHolder, Row row) {

    if (item instanceof Movie) {
        Movie movie = (Movie) item;
        Log.d(TAG, "Item: " + item.toString());
        Intent intent = new Intent(getActivity(), DetailsActivity.class);
        intent.putExtra(getResources().getString(R.string.movie), mSelectedMovie);
        intent.putExtra(getResources().getString(R.string.should_start), true);
        startActivity(intent);


        Bundle bundle = ActivityOptionsCompat.makeSceneTransitionAnimation(
                getActivity(),
                ((ImageCardView) itemViewHolder.view).getMainImageView(),
                DetailsActivity.SHARED_ELEMENT_NAME).toBundle();
        getActivity().startActivity(intent, bundle);
    }
}
项目:Android-High-Performance-Programming    文件:VideoDetailsFragment.java   
@Override
public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item,
                          RowPresenter.ViewHolder rowViewHolder, Row row) {

    if (item instanceof Movie) {
        Movie movie = (Movie) item;
        Log.d(TAG, "Item: " + item.toString());
        Intent intent = new Intent(getActivity(), DetailsActivity.class);
        intent.putExtra(getResources().getString(R.string.movie), mSelectedMovie);
        intent.putExtra(getResources().getString(R.string.should_start), true);
        startActivity(intent);


        Bundle bundle = ActivityOptionsCompat.makeSceneTransitionAnimation(
                getActivity(),
                ((ImageCardView) itemViewHolder.view).getMainImageView(),
                DetailsActivity.SHARED_ELEMENT_NAME).toBundle();
        getActivity().startActivity(intent, bundle);
    }
}
项目:Android-High-Performance-Programming    文件:VideoDetailsFragment.java   
@Override
public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item,
                          RowPresenter.ViewHolder rowViewHolder, Row row) {

    if (item instanceof Movie) {
        Movie movie = (Movie) item;
        Log.d(TAG, "Item: " + item.toString());
        Intent intent = new Intent(getActivity(), DetailsActivity.class);
        intent.putExtra(getResources().getString(R.string.movie), mSelectedMovie);
        intent.putExtra(getResources().getString(R.string.should_start), true);
        startActivity(intent);


        Bundle bundle = ActivityOptionsCompat.makeSceneTransitionAnimation(
                getActivity(),
                ((ImageCardView) itemViewHolder.view).getMainImageView(),
                DetailsActivity.SHARED_ELEMENT_NAME).toBundle();
        getActivity().startActivity(intent, bundle);
    }
}
项目:TvAppRepo    文件:MainFragment.java   
@Override
public void onItemClicked(Presenter.ViewHolder itemViewHolder, final Object item,
                          RowPresenter.ViewHolder rowViewHolder, Row row) {

    if (item instanceof Apk) {
        Apk application = (Apk) item;
        Log.d(TAG, "Item: " + item.toString());
        Intent intent = new Intent(getActivity(), DetailsActivity.class);
        intent.putExtra(DetailsActivity.APPLICATION, application.toString());

        Bundle bundle = ActivityOptionsCompat.makeSceneTransitionAnimation(
                getActivity(),
                ((ImageCardView) itemViewHolder.view).getMainImageView(),
                DetailsActivity.SHARED_ELEMENT_NAME).toBundle();
        getActivity().startActivity(intent, bundle);
    } else if (item instanceof SettingOption) {
        ((SettingOption) item).getClickListener().onClick();
    } else if (item instanceof File) {
        Log.d(TAG, "Open file " + ((File) item).getAbsolutePath());
        mApkDownloadHelper.install((File) item);
    } else if (item instanceof ResolveInfo) {
        GenerateShortcutHelper.begin(mMainActivity, (ResolveInfo) item);
    }
}
项目:popcorn-android    文件:PTVMediaGridFragment.java   
@SuppressWarnings("SuspiciousMethodCalls")
@Override
public void onItemSelected(Presenter.ViewHolder itemViewHolder, Object item, RowPresenter.ViewHolder rowViewHolder, Row row) {
    if (item instanceof MediaCardPresenter.MediaCardItem) {
        MediaCardPresenter.MediaCardItem overviewItem = (MediaCardPresenter.MediaCardItem) item;
        if (overviewItem.isLoading()) return;

        mBackgroundUpdater.updateBackgroundAsync(((MediaCardPresenter.MediaCardItem) item).getMedia().headerImage);
    }

    //really hacky way of making and 'endless' adapter

    //trigger items to update
    int itemPosition = mItems.indexOf(item);

    //when we are within 3 rows of the end, load more items
    if (itemPosition>getAdapter().size()-(NUM_COLUMNS*3)){
        Timber.d("Loading more items: page "+mCurrentPage);
        loadMore();
    }
}
项目:Mediathek    文件:VideoDetailsFragment.java   
@Override
public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item,
                          RowPresenter.ViewHolder rowViewHolder, Row row) {

    if (item instanceof Movie) {
        Movie movie = (Movie) item;
        Log.d(TAG, "Item: " + item.toString());
        Intent intent = new Intent(getActivity(), DetailsActivity.class);
        intent.putExtra(getResources().getString(R.string.movie), mSelectedMovie);
        intent.putExtra(getResources().getString(R.string.should_start), true);
        startActivity(intent);


        Bundle bundle = ActivityOptionsCompat.makeSceneTransitionAnimation(
                getActivity(),
                ((ImageCardView) itemViewHolder.view).getMainImageView(),
                DetailsActivity.SHARED_ELEMENT_NAME).toBundle();
        getActivity().startActivity(intent, bundle);
    }
}
项目:leanback-showcase    文件:VideoGridExampleFragment.java   
@Override
public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item,
                          RowPresenter.ViewHolder rowViewHolder, Row row) {
    if (item instanceof  VideoCard) {
        VideoCard itemCard = (VideoCard) item;
        MediaMetaData metaData = new MediaMetaData();
        metaData.setMediaSourcePath(itemCard.getVideoSource());
        metaData.setMediaTitle(itemCard.getTitle());
        metaData.setMediaArtistName(itemCard.getDescription());
        metaData.setMediaAlbumArtUrl(itemCard.getImageUrl());
        Intent intent = new Intent(getActivity(), VideoExampleActivity.class);
        intent.putExtra(VideoExampleActivity.TAG, metaData);
        intent.setData(Uri.parse(metaData.getMediaSourcePath()));
        getActivity().startActivity(intent);
    }
}
项目:leanback-showcase    文件:CardExampleFragment.java   
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);
    }
}
项目:leanback-showcase    文件:ListenerModule.java   
@PerFragment
@Provides
@IntoMap
@ListenerModuleKey(LiveDataFragment.class)
public OnItemViewSelectedListener provideOnItemViewSelectedListener(final Activity activity,
        final DisplayMetrics metrics, final BackgroundManager backgroundManager,
        final RequestOptions defaultPlaceHolder, final Drawable finalDrawable, final Handler mainHandler) {
    return new OnItemViewSelectedListener() {
        @Override
        public void onItemSelected(Presenter.ViewHolder itemViewHolder, Object item,
                RowPresenter.ViewHolder rowViewHolder, Row row) {
            VideoEntity selectedVideo = (VideoEntity) item;
            RunnableClass backgroundRunnable = new RunnableClass(selectedVideo, activity,
                    metrics, backgroundManager, defaultPlaceHolder, finalDrawable);

            if (lastTime != null) {
                mainHandler.removeCallbacks(lastTime);
            }
            mainHandler.postDelayed(backgroundRunnable, BACKGROUND_UPDATE_DELAY);
            lastTime = backgroundRunnable;
        }
    };
}
项目:leanback-showcase    文件:PageAndListRowFragment.java   
@Override
public Fragment createFragment(Object rowObj) {
    Row row = (Row)rowObj;
    mBackgroundManager.setDrawable(null);
    if (row.getHeaderItem().getId() == HEADER_ID_1) {
        return new SampleFragmentA();
    } else if (row.getHeaderItem().getId() == HEADER_ID_2) {
        return new SampleFragmentB();
    } else if (row.getHeaderItem().getId() == HEADER_ID_3) {
        return new SettingsFragment();
    } else if (row.getHeaderItem().getId() == HEADER_ID_4) {
        return new WebViewFragment();
    }

    throw new IllegalArgumentException(String.format("Invalid row %s", rowObj));
}
项目:leanback-showcase    文件:PageAndListRowFragment.java   
private void setupAdapter() {
    VerticalGridPresenter presenter = new VerticalGridPresenter(ZOOM_FACTOR);
    presenter.setNumberOfColumns(COLUMNS);
    setGridPresenter(presenter);

    CardPresenterSelector cardPresenter = new CardPresenterSelector(getActivity());
    mAdapter = new ArrayObjectAdapter(cardPresenter);
    setAdapter(mAdapter);

    setOnItemViewClickedListener(new OnItemViewClickedListener() {
        @Override
        public void onItemClicked(
                Presenter.ViewHolder itemViewHolder,
                Object item,
                RowPresenter.ViewHolder rowViewHolder,
                Row row) {
            Card card = (Card)item;
            Toast.makeText(getActivity(),
                    "Clicked on "+card.getTitle(),
                    Toast.LENGTH_SHORT).show();
        }
    });
}
项目:leanback-showcase    文件:PageAndListRowFragment.java   
public SampleFragmentB() {
    mRowsAdapter = new ArrayObjectAdapter(new ShadowRowPresenterSelector());

    setAdapter(mRowsAdapter);
    setOnItemViewClickedListener(new OnItemViewClickedListener() {
        @Override
        public void onItemClicked(
                Presenter.ViewHolder itemViewHolder,
                Object item,
                RowPresenter.ViewHolder rowViewHolder,
                Row row) {
            Toast.makeText(getActivity(), "Implement click handler", Toast.LENGTH_SHORT)
                    .show();
        }
    });
}
项目:leanback-showcase    文件:DetailViewExampleWithVideoBackgroundFragment.java   
@Override
public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item,
                          RowPresenter.ViewHolder rowViewHolder, Row row) {
    if (!(item instanceof Action)) return;
    Action action = (Action) item;
    long id = action.getId();

    if (id == ACTION_RENT) {
        startWizardActivityForPayment();
    } else if (action.getId() == ACTION_PLAY) {
        playMainVideoOnBackground();
    } else if (action.getId() == ACTION_RELATED) {
        setSelectedPosition(1);
    } else {
        Toast.makeText(getActivity(), getString(R.string.action_cicked), Toast.LENGTH_LONG)
                .show();
    }
}
项目:sbs-android-tv    文件:DetailsFragment.java   
private OnItemViewClickedListener getItemClickedListener() {
    return new OnItemViewClickedListener() {
        @Override
        public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item, RowPresenter.ViewHolder rowViewHolder, Row row) {
            Log.d(TAG, "Clicked item:" + item);
            if (item instanceof EpisodeBaseModel) {
                EpisodeBaseModel ep = (EpisodeBaseModel) item;
                Intent intent = new Intent(getActivity(), getPlayerActivityClass());
                intent.putExtra(ContentManagerBase.CONTENT_ID, ep);
                String[] others = getOtherEpisodeUrls().toArray(new String[getOtherEpisodeUrls().size()]);
                intent.putExtra(ContentManagerBase.OTHER_EPISODES, others);
                startActivity(intent);
            }
        }
    };
}
项目:danish-media-license    文件:PlaybackFragment.java   
private void initUi() {
  PlaybackControlsRowPresenter presenter = mediaControllerHelper.createControlsRowAndPresenter();
  rows = new ArrayObjectAdapter(presenter);
  rows.add(mediaControllerHelper.getControlsRow());
  setAdapter(rows);
  setOnItemViewClickedListener(new OnItemViewClickedListener() {

    @Override
    public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item,
                              RowPresenter.ViewHolder rowViewHolder, Row row) {
      if (item instanceof Action) {
        mediaControllerHelper.onActionClicked((Action) item);
      }
    }
  });
}
项目:tldrlegal    文件:VideoDetailsFragment.java   
@Override
public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item,
                          RowPresenter.ViewHolder rowViewHolder, Row row) {

    if (item instanceof Movie) {
        Movie movie = (Movie) item;
        Log.d(TAG, "Item: " + item.toString());
        Intent intent = new Intent(getActivity(), DetailsActivity.class);
        intent.putExtra(DetailsActivity.MOVIE, movie);

        Bundle bundle = ActivityOptionsCompat.makeSceneTransitionAnimation(
                getActivity(),
                ((ImageCardView) itemViewHolder.view).getMainImageView(),
                DetailsActivity.SHARED_ELEMENT_NAME).toBundle();
        getActivity().startActivity(intent, bundle);
    }
}
项目:android-UniversalMusicPlayer    文件:TvPlaybackFragment.java   
@Override
public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object clickedItem,
                          RowPresenter.ViewHolder rowViewHolder, Row row) {

    if (clickedItem instanceof MediaSessionCompat.QueueItem) {
        LogHelper.d(TAG, "item: ", clickedItem.toString());

        MediaControllerCompat controller = MediaControllerCompat.getMediaController(getActivity());
        MediaSessionCompat.QueueItem item = (MediaSessionCompat.QueueItem) clickedItem;
        if (!QueueHelper.isQueueItemPlaying(getActivity(), item)
                || controller.getPlaybackState().getState()
                != PlaybackStateCompat.STATE_PLAYING) {
            controller.getTransportControls().skipToQueueItem(item.getQueueId());
        }
    }
}
项目:android-UniversalMusicPlayer    文件:TvVerticalGridFragment.java   
@Override
public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item,
                          RowPresenter.ViewHolder rowViewHolder, Row row) {

    MediaControllerCompat controller = MediaControllerCompat.getMediaController(getActivity());
    if (controller == null) {
        return;
    }
    MediaControllerCompat.TransportControls controls = controller.getTransportControls();
    MediaBrowserCompat.MediaItem mediaItem = (MediaBrowserCompat.MediaItem) item;

    if (!MediaIDHelper.isMediaItemPlaying(getActivity(), mediaItem)) {
        controls.playFromMediaId(mediaItem.getMediaId(), null);
    }

    Intent intent = new Intent(getActivity(), TvPlaybackActivity.class);
    Bundle bundle = ActivityOptionsCompat.makeSceneTransitionAnimation(
            getActivity(),
            ((ImageCardView) itemViewHolder.view).getMainImageView(),
            TvVerticalGridActivity.SHARED_ELEMENT_NAME).toBundle();

    getActivity().startActivity(intent, bundle);
}
项目:sagetv-miniclient    文件:MainFragment.java   
@Override
public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item,
                          RowPresenter.ViewHolder rowViewHolder, Row row) {

    if (item instanceof ServerInfo) {
        ServerInfoUtil.connect(getActivity(), (ServerInfo) item);
    } else if (item instanceof Action) {
        Action action = (Action) item;
        if (action.getActionId() == R.id.preferences) {
            Intent i = new Intent(getActivity(), SettingsActivity.class);
            startActivity(i);
        } else if (action.getActionId() == R.id.btn_add_server) {
            // add new server
            AddServerFragment f = AddServerFragment.newInstance("My Server", "");
            f.setRetainInstance(true);
            f.show(getFragmentManager(), "addserver");
        } else {
            Toast.makeText(getActivity(), item.toString(), Toast.LENGTH_SHORT)
                    .show();
        }
    }
}
项目:sagetv-miniclient    文件:MainFragment.java   
@Override
public void onItemSelected(Presenter.ViewHolder itemViewHolder, Object item,
                           RowPresenter.ViewHolder rowViewHolder, Row row) {
    if (item instanceof Action) {
        mBackgroundURI = ((Action) item).getBackground();
        if (mBackgroundURI == null) mBackgroundURI = mDefaultBackgroundNoBackground;
        startBackgroundTimer();
    } else if (item instanceof ServerInfo) {
        if (((ServerInfo) item).isLocatorOnly()) {
            mBackgroundURI = R.drawable.back_film_wall;
            startBackgroundTimer();
        } else {
            mBackgroundURI = R.drawable.back_dark_knight;
            startBackgroundTimer();
        }
    } else {
        mBackgroundURI = mDefaultBackgroundNoBackground;
        startBackgroundTimer();
    }

}
项目:Mizuu-Android-TV    文件:MainFragment.java   
@Override
public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item,
                          RowPresenter.ViewHolder rowViewHolder, Row row) {
    if (item instanceof Movie) {
        Movie movie = (Movie) item;
        Log.d(TAG, "Item: " + item.toString());
        Intent intent = new Intent(getActivity(), DetailsActivity.class);
        intent.putExtra(DetailsActivity.MOVIE, movie);

        Bundle bundle = ActivityOptionsCompat.makeSceneTransitionAnimation(
                getActivity(),
                ((ImageCardView) itemViewHolder.view).getMainImageView(),
                DetailsActivity.SHARED_ELEMENT_NAME).toBundle();
        getActivity().startActivity(intent, bundle);
    } else if (item instanceof String) {
        Toast.makeText(getActivity(), ((String) item), Toast.LENGTH_SHORT)
                .show();
    }
}
项目:Mizuu-Android-TV    文件:VideoDetailsFragment.java   
@Override
public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item,
                          RowPresenter.ViewHolder rowViewHolder, Row row) {

    if (item instanceof Movie) {
        Movie movie = (Movie) item;
        Log.d(TAG, "Item: " + item.toString());
        Intent intent = new Intent(getActivity(), DetailsActivity.class);
        intent.putExtra(DetailsActivity.MOVIE, movie);

        Bundle bundle = ActivityOptionsCompat.makeSceneTransitionAnimation(
                getActivity(),
                ((ImageCardView) itemViewHolder.view).getMainImageView(),
                DetailsActivity.SHARED_ELEMENT_NAME).toBundle();
        getActivity().startActivity(intent, bundle);
    }
}