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

项目:HelloTV    文件:CardPresenter.java   
@Override
public void onBindViewHolder(Presenter.ViewHolder viewHolder, Object item) {
    Movie movie = (Movie) item;
    ImageCardView cardView = (ImageCardView) viewHolder.view;

    Log.d(TAG, "onBindViewHolder");
    if (movie.getCardImageUrl() != null) {
        cardView.setTitleText(movie.getTitle());
        cardView.setContentText(movie.getStudio());
        cardView.setMainImageDimensions(CARD_WIDTH, CARD_HEIGHT);
        Glide.with(viewHolder.view.getContext())
                .load(movie.getCardImageUrl())
                .centerCrop()
                .error(mDefaultCardImage)
                .into(cardView.getMainImageView());
    }
}
项目: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    文件:CardPresenter.java   
@Override
public void onBindViewHolder(Presenter.ViewHolder viewHolder, Object item) {
    Movie movie = (Movie) item;
    ImageCardView cardView = (ImageCardView) viewHolder.view;

    Log.d(TAG, "onBindViewHolder");
    if (movie.getCardImageUrl() != null) {
        cardView.setTitleText(movie.getTitle());
        cardView.setContentText(movie.getStudio());
        cardView.setMainImageDimensions(CARD_WIDTH, CARD_HEIGHT);
        Glide.with(viewHolder.view.getContext())
                .load(movie.getCardImageUrl())
                .centerCrop()
                .error(mDefaultCardImage)
                .into(cardView.getMainImageView());
    }
}
项目: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);
    }
}
项目:chaosflix-leanback    文件:HeaderItemPresenter.java   
@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());
    }
}
项目:tubik    文件:CardPresenter.java   
@Override
public void onBindViewHolder(Presenter.ViewHolder viewHolder, Object item) {
    Movie movie = (Movie) item;
    ImageCardView cardView = (ImageCardView) viewHolder.view;

    Log.d(TAG, "onBindViewHolder");
    if (movie.getCardImageUrl() != null) {
        cardView.setTitleText(movie.getTitle());
        cardView.setContentText(movie.getStudio());
        cardView.setMainImageDimensions(CARD_WIDTH, CARD_HEIGHT);
        Glide.with(viewHolder.view.getContext())
                .load(movie.getCardImageUrl())
                .centerCrop()
                .error(mDefaultCardImage)
                .into(cardView.getMainImageView());
    }
}
项目: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);
    }
}
项目:androidtv-sample    文件:MainFragment.java   
private void setupUIElements() {
    setBadgeDrawable(
            getActivity().getResources().getDrawable(R.drawable.nejcz, null));
    setTitle(getString(R.string.browse_title)); // Badge, when set, takes precedent over title
    setHeadersState(HEADERS_ENABLED);
    setHeadersTransitionOnBackEnabled(true);

    // Set fastLane (or headers) background color
    setBrandColor(ContextCompat.getColor(getActivity(), R.color.fastlane_background));

    // Set search icon color.
    setSearchAffordanceColor(ContextCompat.getColor(getActivity(), R.color.search_opaque));

    setHeaderPresenterSelector(new PresenterSelector() {
        @Override
        public Presenter getPresenter(Object o) {
            return new IconHeaderItemPresenter();
        }
    });
}
项目: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);
    }
}
项目:cleaninsights-android-sdk    文件:CardPresenter.java   
@Override
public void onBindViewHolder(Presenter.ViewHolder viewHolder, Object item) {
    Movie movie = (Movie) item;
    ImageCardView cardView = (ImageCardView) viewHolder.view;

    Log.d(TAG, "onBindViewHolder");
    if (movie.getCardImageUrl() != null) {
        cardView.setTitleText(movie.getTitle());
        cardView.setContentText(movie.getStudio());
        cardView.setMainImageDimensions(CARD_WIDTH, CARD_HEIGHT);
        Glide.with(viewHolder.view.getContext())
                .load(movie.getCardImageUrl())
                .centerCrop()
                .error(mDefaultCardImage)
                .into(cardView.getMainImageView());
    }
}
项目:androidtv-sample    文件:CardPresenter.java   
@Override
public void onBindViewHolder(Presenter.ViewHolder viewHolder, Object item) {
    Video video = (Video) item;

    ImageCardView cardView = (ImageCardView) viewHolder.view;
    cardView.setTitleText(video.title);
    cardView.setContentText(video.studio);

    if (video.cardImageUrl != null) {
        // Set card size from dimension resources.
        Resources res = cardView.getResources();
        int width = res.getDimensionPixelSize(R.dimen.card_width);
        int height = res.getDimensionPixelSize(R.dimen.card_height);
        cardView.setMainImageDimensions(width, height);

        Glide.with(cardView.getContext())
                .load(video.cardImageUrl)
                .error(mDefaultCardImage)
                .diskCacheStrategy(NONE)
                .into(cardView.getMainImageView());

        //obnovit obrazek
    }
}
项目: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-extensions    文件:CardPresenterSelector.java   
@Override
public Presenter getPresenter(Object o) {
    if (o instanceof Movie) {
        if (((Movie) o).getCategory().equals(MOVIE_CATEGORY[0])) {
            return new IconCardPresenter();
        } else if (((Movie) o).getCategory().equals(MOVIE_CATEGORY[1])) {
            return new LoadingCardPresenter();
        } else if (((Movie) o).getCategory().equals(MOVIE_CATEGORY[2])) {
            return new OverlayCardPresenter();
        } else {
            return new ProcessCardPresenter();
        }
    } else {
        return new CardPresenter();
    }
}
项目:leanback-extensions    文件:CardPresenter.java   
@Override
public void onBindViewHolder(Presenter.ViewHolder viewHolder, Object item) {
    Movie movie = (Movie) item;
    ImageCardView cardView = (ImageCardView) viewHolder.view;

    Log.d(TAG, "onBindViewHolder");
    if (movie.getCardImageUrl() != null) {
        cardView.setTitleText(movie.getTitle());
        cardView.setContentText(movie.getStudio());
        cardView.setMainImageDimensions(CARD_WIDTH, CARD_HEIGHT);
        Glide.with(viewHolder.view.getContext())
                .load(movie.getCardImageUrl())
                .centerCrop()
                .error(mDefaultCardImage)
                .into(cardView.getMainImageView());
    }
}
项目: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    文件:CardPresenter.java   
@Override
public void onBindViewHolder(Presenter.ViewHolder viewHolder, Object item) {
    Clip clip = (Clip) item;
    if (clip.getCardImageUrl() != null) {
        ImageCardView cardView = (ImageCardView) viewHolder.view;
        Resources resources = cardView.getContext().getResources();
        cardView.setTitleText(clip.getTitle());
        cardView.setContentText(clip.getDescription());
        float widthMultiplier = getWidthMultplier(clip.getAspectRatio());
        int cardWidth = Math.round(resources.getDimensionPixelSize(R.dimen.card_width)
                * widthMultiplier);
        int cardHeight = resources.getDimensionPixelSize(R.dimen.card_height);
        cardView.setMainImageDimensions(cardWidth, cardHeight);
        Glide.with(viewHolder.view.getContext())
                .load(clip.getCardImageUrl())
                .into(cardView.getMainImageView());
    }
}
项目:leanback-homescreen-channels    文件:AddChannelPresenter.java   
@Override
public void onBindViewHolder(Presenter.ViewHolder viewHolder, Object item) {
    final Playlist playlist = (Playlist) item;
    AddChannelViewHolder addChannelViewHolder = (AddChannelViewHolder) viewHolder;
    String descriptionText = String.format(mDescriptionFormat, playlist.getName());
    addChannelViewHolder.mDescription.setText(descriptionText);
    if (addChannelViewHolder.mOnButtonClickedListener != null) {
        addChannelViewHolder.mButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (mOnButtonClickedListener != null) {
                    mOnButtonClickedListener.onButtonClicked(playlist);
                }
            }
        });
    }
}
项目:chaosflix    文件:HeaderItemPresenter.java   
@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());
    }
}
项目: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    文件:ListingFragment.java   
private void openDetailsActivity(Video video, Presenter.ViewHolder itemViewHolder) {
    Intent intent = new Intent(getActivity(), VideoDetailsActivity.class);
    intent.putExtra(VideoDetailsFragment.EXTRA_VIDEO, video);
    intent.putExtra(VideoDetailsFragment.EXTRA_FORCE_VIDEO_SELECTION, true);
    View sourceView = null;
    if (itemViewHolder.view instanceof ImageCardView) {
        sourceView = ((ImageCardView) itemViewHolder.view).getMainImageView();
    } else if (itemViewHolder instanceof ListPresenter.ListViewHolder){
        sourceView = ((ListPresenter.ListViewHolder)itemViewHolder).getImageView();
    }

    Bundle bundle = ActivityOptionsCompat.makeSceneTransitionAnimation(
            getActivity(),
            sourceView,
            VideoDetailsActivity.SHARED_ELEMENT_NAME).toBundle();

    getActivity().startActivityForResult(intent, ListingActivity.REQUEST_INFO_ACTIVITY, bundle);
}
项目:leanback-assistant    文件:VideoDetailsFragment.java   
@Override
public Presenter.ViewHolder onCreateViewHolder(ViewGroup parent) {
    ImageView imageView =
            (ImageView)
                    LayoutInflater.from(parent.getContext())
                            .inflate(
                                    R.layout.lb_fullwidth_details_overview_logo,
                                    parent,
                                    false);

    Resources res = parent.getResources();
    int width = res.getDimensionPixelSize(R.dimen.detail_thumb_width);
    int height = res.getDimensionPixelSize(R.dimen.detail_thumb_height);
    imageView.setLayoutParams(new ViewGroup.MarginLayoutParams(width, height));
    imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);

    return new ViewHolder(imageView);
}
项目:aos-Video    文件:VideoViewClickedListener.java   
public static void showVideoDetails(Activity activity, Video video, Presenter.ViewHolder itemViewHolder, boolean animate, boolean forceSelection, boolean shouldLoadBackdrop, long listId) {
    Intent intent = new Intent(activity, VideoDetailsActivity.class);
    intent.putExtra(VideoDetailsFragment.EXTRA_VIDEO, video);
    intent.putExtra(VideoDetailsFragment.EXTRA_LIST_ID, listId);
    intent.putExtra(VideoDetailsFragment.EXTRA_FORCE_VIDEO_SELECTION, forceSelection);
    intent.putExtra(VideoDetailsFragment.EXTRA_SHOULD_LOAD_BACKDROP,shouldLoadBackdrop);
    View sourceView = null;
    if (itemViewHolder.view instanceof ImageCardView) {
        sourceView = ((ImageCardView) itemViewHolder.view).getMainImageView();
    } else if (itemViewHolder instanceof ListPresenter.ListViewHolder){
        sourceView = ((ListPresenter.ListViewHolder)itemViewHolder).getImageView();
    }
    if(animate) {
        Bundle bundle = ActivityOptionsCompat.makeSceneTransitionAnimation(
                activity,
                sourceView,
                VideoDetailsActivity.SHARED_ELEMENT_NAME).toBundle();

        activity.startActivity(intent,bundle);
    }
    else{
        activity.startActivity(intent);
    }
}
项目: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);


            }
        }
}
项目:chilly    文件:IconHeaderItemPresenter.java   
@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());
}
项目:chilly    文件:MainFragment.java   
private void setupUIElements() {
    setBadgeDrawable(
            getActivity().getResources().getDrawable(R.drawable.app_icon_chilly_transparent, null));
    setTitle(getString(R.string.browse_title)); // Badge, when set, takes precedent over title
    setHeadersState(HEADERS_DISABLED);
    setHeadersTransitionOnBackEnabled(true);

    // Set fastLane (or headers) background color
    setBrandColor(ContextCompat.getColor(getActivity(), R.color.fastlane_background));

    // Set search icon color.
    setSearchAffordanceColor(ContextCompat.getColor(getActivity(), R.color.search_opaque));

    setHeaderPresenterSelector(new PresenterSelector() {
        @Override
        public Presenter getPresenter(Object o) {
            return new IconHeaderItemPresenter();
        }
    });
}
项目:chilly    文件:VideoDetailsFragment.java   
@Override
public Presenter.ViewHolder onCreateViewHolder(ViewGroup parent) {
    ImageView imageView = (ImageView) LayoutInflater.from(parent.getContext())
            .inflate(R.layout.lb_fullwidth_details_overview_logo, parent, false);

    Resources res = parent.getResources();
    int width = res.getDimensionPixelSize(R.dimen.detail_thumb_width);
    int height = res.getDimensionPixelSize(R.dimen.detail_thumb_height);

    if(mSelectedVideo.videoType.equals("episode")) {
        height = res.getDimensionPixelSize(R.dimen.detail_thumb_episode_height);
    }

    imageView.setLayoutParams(new ViewGroup.MarginLayoutParams(width, height));
    imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);

    return new ViewHolder(imageView);
}
项目:HelloTV    文件:MainFragment.java   
@Override
public void onItemSelected(Presenter.ViewHolder itemViewHolder, Object item,
                           RowPresenter.ViewHolder rowViewHolder, Row row) {
    if (item instanceof Movie) {
        mBackgroundURI = ((Movie) item).getBackgroundImageURI();
        startBackgroundTimer();
    }

}
项目:chilly    文件:VerticalGridFragment.java   
@Override
public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item,
        RowPresenter.ViewHolder rowViewHolder, Row row) {

    if (item instanceof Video) {
        Video video = (Video) item;
        cardView = (ImageCardView) itemViewHolder.view;
        new ChillyTasks.ImageLoaderTask(getActivity().getApplicationContext(), this, video).execute();
    }
}
项目:lostfilm-android-client    文件:MainFragment.java   
@Override
public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item, RowPresenter.ViewHolder rowViewHolder, Row row) {
    mJobHelper.scheduleTvShowSeasonsUpdate(((TvShow) item).getId(), ((TvShow) item).getAlias());
    Intent intent = new Intent(getActivity(), TvShowActivity.class);
    intent.putExtra(TvShowActivity.EXTRA_TVSHOW_ID, ((TvShow) item).getId());
    startActivity(intent, ActivityOptions.makeSceneTransitionAnimation(getActivity()).toBundle());
}
项目:lostfilm-android-client    文件:TvShowFragment.java   
@Override
public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item, RowPresenter.ViewHolder rowViewHolder, Row row) {
    Episode episode = (Episode) item;

    Intent intent = new Intent(getActivity(), PlayerActivity.class);
    intent.putExtra(PlayerActivity.EXTRA_EPISODE_ID, episode.getId());
    intent.putExtra(PlayerActivity.EXTRA_SEASON_ID, episode.getSeason().getId());
    intent.putExtra(PlayerActivity.EXTRA_TV_SHOW_ID, episode.getSeason().getTvShow().getId());
    startActivity(intent, ActivityOptions.makeSceneTransitionAnimation(getActivity()).toBundle());
}
项目:garras    文件:CardPresenter.java   
@Override
public void onUnbindViewHolder(Presenter.ViewHolder viewHolder) {
    Log.d(TAG, "onUnbindViewHolder");
    ImageCardView cardView = (ImageCardView) viewHolder.view;
    // Remove references to images so that the garbage collector can free up memory
    cardView.setBadgeImage(null);
    cardView.setMainImage(null);
}
项目:webradio-tv-app    文件:CardPresenterSelector.java   
@Override
public Presenter getPresenter(Object item) {
    if (!(item instanceof Card)) throw new RuntimeException(
            String.format("The PresenterSelector only supports data items of type '%s'",
                    Card.class.getName()));
    Card card = (Card) item;
    Presenter presenter = presenters.get(card.getType());
    if (presenter == null) {
        presenter = new ImageCardViewPresenter(mContext, card);
    }
    presenters.put(card.getType(), presenter);
    return presenter;
}
项目:chaosflix-leanback    文件:EventsDetailsFragment.java   
@Override
public Presenter.ViewHolder onCreateViewHolder(ViewGroup parent) {
    ImageView imageView = (ImageView) LayoutInflater.from(parent.getContext())
            .inflate(R.layout.lb_fullwidth_details_overview_logo, parent, false);

    Resources res = parent.getResources();
    int width = res.getDimensionPixelSize(R.dimen.detail_thumb_width);
    int height = res.getDimensionPixelSize(R.dimen.detail_thumb_height);
    imageView.setLayoutParams(new ViewGroup.MarginLayoutParams(width, height));
    imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);

    return new ViewHolder(imageView);
}
项目:chaosflix-leanback    文件:EventsDetailsFragment.java   
@Override
public void onBindViewHolder(Presenter.ViewHolder viewHolder, Object item) {
    DetailsOverviewRow row = (DetailsOverviewRow) item;
    ImageView imageView = ((ImageView) viewHolder.view);
    imageView.setImageDrawable(row.getImageDrawable());
    if (isBoundToImage((ViewHolder) viewHolder, row)) {
        EventDetailsOverviewLogoPresenter.ViewHolder vh =
                (EventDetailsOverviewLogoPresenter.ViewHolder) viewHolder;
        vh.getParentPresenter().notifyOnBindLogo(vh.getParentViewHolder());
    }
}
项目:chaosflix-leanback    文件:CardPresenter.java   
@Override
public void onUnbindViewHolder(Presenter.ViewHolder viewHolder) {
    ImageCardView cardView = (ImageCardView) viewHolder.view;
    // Remove references to images so that the garbage collector can free up memory
    cardView.setBadgeImage(null);
    cardView.setMainImage(null);
}
项目:MyTvLauncher    文件:CardPresenter.java   
@Override
public void onBindViewHolder(Presenter.ViewHolder viewHolder, Object item) {
    CardModel list = (CardModel) item;
    ImageCardView cardView = (ImageCardView) viewHolder.view;

    Log.d(TAG, "onBindViewHolder");
    cardView.setTitleText(list.getTitle());
    cardView.setContentText(list.getTitle());
    cardView.setMainImageDimensions(CARD_WIDTH, CARD_HEIGHT);
    cardView.setMainImageScaleType(ImageView.ScaleType.CENTER_INSIDE);
    cardView.getMainImageView().setImageResource(R.drawable.barcode);
}
项目:MyTvLauncher    文件:CardPresenter.java   
@Override
public void onUnbindViewHolder(Presenter.ViewHolder viewHolder) {
    Log.d(TAG, "onUnbindViewHolder");
    ImageCardView cardView = (ImageCardView) viewHolder.view;
    // Remove references to images so that the garbage collector can free up memory
    cardView.setBadgeImage(null);
    cardView.setMainImage(null);
}
项目:tubik    文件:MainFragment.java   
@Override
public void onItemSelected(Presenter.ViewHolder itemViewHolder, Object item,
                           RowPresenter.ViewHolder rowViewHolder, Row row) {
    if (item instanceof Movie) {
        mBackgroundURI = ((Movie) item).getBackgroundImageURI();
        startBackgroundTimer();
    }

}