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


Java Presenter类代码示例

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


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

示例1: setupUIElements

import android.support.v17.leanback.widget.Presenter; //导入依赖的package包/类
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();
        }
    });
}
 
开发者ID:nejtv,项目名称:androidtv-sample,代码行数:21,代码来源:MainFragment.java

示例2: onBindViewHolder

import android.support.v17.leanback.widget.Presenter; //导入依赖的package包/类
@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());
    }
}
 
开发者ID:bassaer,项目名称:HelloTV,代码行数:18,代码来源:CardPresenter.java

示例3: onItemClicked

import android.support.v17.leanback.widget.Presenter; //导入依赖的package包/类
@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);
    }
}
 
开发者ID:bassaer,项目名称:HelloTV,代码行数:21,代码来源:VideoDetailsFragment.java

示例4: onItemClicked

import android.support.v17.leanback.widget.Presenter; //导入依赖的package包/类
@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);
    }
}
 
开发者ID:alphater,项目名称:garras,代码行数:17,代码来源:VideoDetailsFragment.java

示例5: onBindViewHolder

import android.support.v17.leanback.widget.Presenter; //导入依赖的package包/类
@Override
public void onBindViewHolder(Presenter.ViewHolder viewHolder, Object item) {
	HeaderItem headerItem = ((ListRow) item).getHeaderItem();
	View view = viewHolder.view;
	ImageView headerIcon = (ImageView) view.findViewById(R.id.header_icon);
	TextView headerLabel = (TextView) view.findViewById(R.id.header_label);

	Resources resources = view.getContext().getResources();
	String streamingPrefix = resources.getString(R.string.streaming_prefix);
	if (headerItem.getName().startsWith(streamingPrefix)) {
		Drawable camIcon = resources.getDrawable(R.drawable.ic_videocam_white_24dp);
		headerIcon.setImageDrawable(camIcon);
		((ListRow) item).setHeaderItem(new HeaderItem(headerItem.getName()
				.substring(streamingPrefix.length())));
	} else {
		Drawable movieIcon = resources.getDrawable(R.drawable.ic_local_movies_white_24dp);
		headerIcon.setImageDrawable(movieIcon);
		headerLabel.setText(headerItem.getName());
	}
}
 
开发者ID:NiciDieNase,项目名称:chaosflix-leanback,代码行数:21,代码来源:HeaderItemPresenter.java

示例6: onItemClicked

import android.support.v17.leanback.widget.Presenter; //导入依赖的package包/类
@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);
    }
}
 
开发者ID:nejtv,项目名称:androidtv-sample,代码行数:17,代码来源:PlaybackOverlayFragment.java

示例7: onItemClicked

import android.support.v17.leanback.widget.Presenter; //导入依赖的package包/类
@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);
    }
}
 
开发者ID:nejtv,项目名称:androidtv-sample,代码行数:17,代码来源:VideoDetailsFragment.java

示例8: onBindViewHolder

import android.support.v17.leanback.widget.Presenter; //导入依赖的package包/类
@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
    }
}
 
开发者ID:nejtv,项目名称:androidtv-sample,代码行数:25,代码来源:CardPresenter.java

示例9: onItemClicked

import android.support.v17.leanback.widget.Presenter; //导入依赖的package包/类
@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();
    }
}
 
开发者ID:nejtv,项目名称:androidtv-sample,代码行数:19,代码来源:SearchFragment.java

示例10: onItemClicked

import android.support.v17.leanback.widget.Presenter; //导入依赖的package包/类
@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);
    }
}
 
开发者ID:nejtv,项目名称:androidtv-sample,代码行数:18,代码来源:VerticalGridFragment.java

示例11: getPresenter

import android.support.v17.leanback.widget.Presenter; //导入依赖的package包/类
@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();
	}
}
 
开发者ID:fasteque,项目名称:leanback-extensions,代码行数:17,代码来源:CardPresenterSelector.java

示例12: onBindViewHolder

import android.support.v17.leanback.widget.Presenter; //导入依赖的package包/类
@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());
	}
}
 
开发者ID:fasteque,项目名称:leanback-extensions,代码行数:18,代码来源:CardPresenter.java

示例13: onItemClicked

import android.support.v17.leanback.widget.Presenter; //导入依赖的package包/类
@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());
            }
        }
    }
}
 
开发者ID:googlesamples,项目名称:leanback-homescreen-channels,代码行数:19,代码来源:MainFragment.java

示例14: onBindViewHolder

import android.support.v17.leanback.widget.Presenter; //导入依赖的package包/类
@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());
    }
}
 
开发者ID:googlesamples,项目名称:leanback-homescreen-channels,代码行数:19,代码来源:CardPresenter.java

示例15: onBindViewHolder

import android.support.v17.leanback.widget.Presenter; //导入依赖的package包/类
@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);
                }
            }
        });
    }
}
 
开发者ID:googlesamples,项目名称:leanback-homescreen-channels,代码行数:18,代码来源:AddChannelPresenter.java


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