Java Code Examples for androidx.leanback.widget.ImageCardView#setFocusable()
The following examples show how to use
androidx.leanback.widget.ImageCardView#setFocusable() .
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: VideoCardPresenter.java From tv-samples with Apache License 2.0 | 6 votes |
@Override public ViewHolder onCreateViewHolder(ViewGroup parent) { Context mContext = parent.getContext(); sDefaultBackgroundColor = ContextCompat.getColor(parent.getContext(), R.color.default_background); sSelectedBackgroundColor = ContextCompat.getColor(parent.getContext(), R.color.selected_background); sDefaultCardImage = parent.getResources().getDrawable(R.drawable.no_cache_no_internet, null); ImageCardView cardView = new ImageCardView(parent.getContext()) { @Override public void setSelected(boolean selected) { updateCardBackgroundColor(this, selected); super.setSelected(selected); } }; cardView.setFocusable(true); cardView.setFocusableInTouchMode(true); updateCardBackgroundColor(cardView, false); return new CardViewHolder(cardView, mContext); }
Example 2
Source File: VideoContentCardPresenter.java From tv-samples with Apache License 2.0 | 6 votes |
@Override public ViewHolder onCreateViewHolder(ViewGroup parent) { Context context = parent.getContext(); sDefaultBackgroundColor = ContextCompat.getColor(context, R.color.default_background); sSelectedBackgroundColor = ContextCompat.getColor(context, R.color.selected_background); ImageCardView cardView = new ImageCardView(parent.getContext()) { @Override public void setSelected(boolean selected) { updateCardBackgroundColor(this, selected); super.setSelected(selected); } }; cardView.setFocusable(true); cardView.setFocusableInTouchMode(true); updateCardBackgroundColor(cardView, false); return new ViewHolder(cardView); }
Example 3
Source File: CardPresenter.java From tv-samples with Apache License 2.0 | 6 votes |
@Override public ViewHolder onCreateViewHolder(ViewGroup parent) { mDefaultBackgroundColor = ContextCompat.getColor(parent.getContext(), R.color.default_background); mSelectedBackgroundColor = ContextCompat.getColor(parent.getContext(), R.color.selected_background); mDefaultCardImage = parent.getResources().getDrawable(R.drawable.movie, null); ImageCardView cardView = new ImageCardView(parent.getContext()) { @Override public void setSelected(boolean selected) { updateCardBackgroundColor(this, selected); super.setSelected(selected); } }; cardView.setFocusable(true); cardView.setFocusableInTouchMode(true); updateCardBackgroundColor(cardView, false); return new ViewHolder(cardView); }
Example 4
Source File: CardPresenter.java From androidtv-Leanback with Apache License 2.0 | 6 votes |
@Override public ViewHolder onCreateViewHolder(ViewGroup parent) { mDefaultBackgroundColor = ContextCompat.getColor(parent.getContext(), R.color.default_background); mSelectedBackgroundColor = ContextCompat.getColor(parent.getContext(), R.color.selected_background); mDefaultCardImage = parent.getResources().getDrawable(R.drawable.movie, null); ImageCardView cardView = new ImageCardView(parent.getContext()) { @Override public void setSelected(boolean selected) { updateCardBackgroundColor(this, selected); super.setSelected(selected); } }; cardView.setFocusable(true); cardView.setFocusableInTouchMode(true); updateCardBackgroundColor(cardView, false); return new ViewHolder(cardView); }
Example 5
Source File: CardViewPresenter.java From xipl with Apache License 2.0 | 5 votes |
@Override public Presenter.ViewHolder onCreateViewHolder(ViewGroup parent) { ImageCardView imageCardView = new ImageCardView(parent.getContext()); int widthPixels = (int) parent.getResources().getDimension(R.dimen.cardview_presenter_width); int heightPixels = (int) parent.getResources().getDimension(R.dimen.cardview_presenter_height); imageCardView.setInfoVisibility(BaseCardView.CARD_REGION_VISIBLE_ALWAYS); imageCardView.setFocusable(true); imageCardView.setFocusableInTouchMode(true); imageCardView.setMainImageDimensions(widthPixels, heightPixels); return (new ViewHolder(imageCardView)); }