android.support.v17.leanback.widget.BaseCardView Java Examples
The following examples show how to use
android.support.v17.leanback.widget.BaseCardView.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SideInfoCardPresenter.java From leanback-showcase with Apache License 2.0 | 5 votes |
@Override protected BaseCardView onCreateView() { final BaseCardView cardView = new BaseCardView(getContext(), null, R.style.SideInfoCardStyle); cardView.setFocusable(true); cardView.addView(LayoutInflater.from(getContext()).inflate(R.layout.side_info_card, null)); return cardView; }
Example #2
Source File: SideInfoCardPresenter.java From leanback-showcase with Apache License 2.0 | 5 votes |
@Override public void onBindViewHolder(Card card, BaseCardView cardView) { ImageView imageView = (ImageView) cardView.findViewById(R.id.main_image); if (card.getLocalImageResourceName() != null) { int width = (int) getContext().getResources() .getDimension(R.dimen.sidetext_image_card_width); int height = (int) getContext().getResources() .getDimension(R.dimen.sidetext_image_card_height); int resourceId = getContext().getResources() .getIdentifier(card.getLocalImageResourceName(), "drawable", getContext().getPackageName()); RequestOptions myOptions = new RequestOptions() .override(width, height); Glide.with(getContext()) .asBitmap() .load(resourceId) .apply(myOptions) .into(imageView); } TextView primaryText = (TextView) cardView.findViewById(R.id.primary_text); primaryText.setText(card.getTitle()); TextView secondaryText = (TextView) cardView.findViewById(R.id.secondary_text); secondaryText.setText(card.getDescription()); TextView extraText = (TextView) cardView.findViewById(R.id.extra_text); extraText.setText(card.getExtraText()); }
Example #3
Source File: VideoPlayerView.java From iview-android-tv with MIT License | 4 votes |
public VideoPlayerView(Context context, PlaybackControls controller, View root) { mContext = context; mediaController = controller; shutterView = root.findViewById(R.id.shutter); videoFrame = (AspectRatioFrameLayout) root.findViewById(R.id.video_frame); surfaceView = (SurfaceView) root.findViewById(R.id.surface_view); debugTextView = (TextView) root.findViewById(R.id.debug_text_view); debugView = root.findViewById(R.id.debug_view); statusTextView = (TextView) root.findViewById(R.id.status); playerStateTextView = (TextView) root.findViewById(R.id.player_state_view); subtitleLayout = (SubtitleLayout) root.findViewById(R.id.subtitles); nextEpisodeCard = root.findViewById(R.id.next_episode_card); episodeDetails = root.findViewById(R.id.episode_details); episodeTitle = (TextView) root.findViewById(R.id.episode_title); seriesTitle = (TextView) root.findViewById(R.id.series_title); duration = (TextView) root.findViewById(R.id.duration); ImageCardView card = (ImageCardView) root.findViewById(R.id.next_episode); card.setFocusable(true); card.setFocusableInTouchMode(true); card.setInfoVisibility(View.VISIBLE); card.setExtraVisibility(View.VISIBLE); card.setInfoAreaBackgroundColor(context.getResources().getColor(R.color.black_900)); Point size = new Point(context.getResources().getDimensionPixelSize(R.dimen.card_width), context.getResources().getDimensionPixelSize(R.dimen.card_height)); nextEpisode = new EpisodeCardView(context, card, size, false); nextEpisode.getImageCardView().setCardType(BaseCardView.CARD_TYPE_INFO_OVER); debugView.setVisibility(View.GONE); root.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View view, MotionEvent motionEvent) { return handleTouchEvents(view, motionEvent); } }); root.setOnKeyListener(new View.OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { return handleKeyEvents(v, keyCode, event); } }); }