public ListViewHolder(Context context) { super(new BaseCardView(context)); mBaseCardView = (BaseCardView)view; mBaseCardView.setBackgroundColor(context.getResources().getColor(R.color.lb_basic_card_bg_color)); mBaseCardView.setFocusable(true); mBaseCardView.setFocusableInTouchMode(true); mBaseCardView.setCardType(BaseCardView.CARD_TYPE_MAIN_ONLY); LayoutInflater.from(context).inflate(R.layout.leanback_listitem_cardview_content, mBaseCardView, true); mImageView = (ImageView)mBaseCardView.findViewById(R.id.image); mTitleTv = (TextView)mBaseCardView.findViewById(R.id.title); mContentTv = (TextView)mBaseCardView.findViewById(R.id.content); mProgressBar = mBaseCardView.findViewById(R.id.resume_bar); mWatchedIcon = mBaseCardView.findViewById(R.id.watched_icon); // Hide progressbar and watched icon by default mProgressBar.setVisibility(View.GONE); mWatchedIcon.setVisibility(View.GONE); mImageViewTarget = new PicassoImageViewTarget(mImageView); }
public ViewHolder(Context context) { super(new CustomBaseCardview(context)); mBaseCardView = (BaseCardView)view; mBaseCardView.setBackgroundColor(context.getResources().getColor(R.color.lb_basic_card_bg_color)); mBaseCardView.setFocusable(true); mBaseCardView.setFocusableInTouchMode(true); mBaseCardView.setCardType(BaseCardView.CARD_TYPE_MAIN_ONLY); mBaseCardView.setLayoutParams(new ViewGroup.LayoutParams(getWidth(context), getHeight(context))); mImageView = (ImageView)LayoutInflater.from(context).inflate(R.layout.leanback_imageonly_cardview_content, mBaseCardView, false); mBaseCardView.addView(mImageView); ViewGroup.LayoutParams lp = mImageView.getLayoutParams(); lp.width = getWidth(context); lp.height = getHeight(context); mImageView.setLayoutParams(lp); mImageViewTarget = new PicassoImageViewTarget(mImageView); }
public VideoViewHolder(Context context) { super(new CustomImageCardview(context)); mOccurenciesView= LayoutInflater.from(mContext).inflate(R.layout.leanback_video_occurencies, mCardView, false); mOccurenciesView.setVisibility(View.INVISIBLE); mCardView = (CustomImageCardview)view; mCardView.addViewToRoot(mOccurenciesView); mCardView.setMainImageDimensions(getWidth(context), getHeight(context)); mCardView.setMainImage(new ColorDrawable(context.getResources().getColor(R.color.lb_basic_card_bg_color))); mCardView.setFocusable(true); mCardView.setFocusableInTouchMode(true); View progressGroup = LayoutInflater.from(mContext).inflate(R.layout.leanback_resume, mCardView, false); mProgressBar = progressGroup.findViewById(R.id.resume_bar); // Set progressbar to 0 by default mProgressBar.getLayoutParams().width = 0; BaseCardView.LayoutParams lp = new BaseCardView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); lp.viewType = BaseCardView.LayoutParams.VIEW_TYPE_INFO; mCardView.addView(progressGroup, mCardView.getChildCount(), lp); mImageCardViewTarget = new PicassoImageCardViewTarget(mCardView); }
public WebPageLinkViewHolder(ViewGroup parent) { super(new BaseCardView(parent.getContext())); mCard = (BaseCardView)view; mCard.setFocusable(true); mCard.setFocusableInTouchMode(true); Context c = parent.getContext(); mPlaceholder = new View(c); mPlaceholder.setBackgroundColor(c.getResources().getColor(R.color.lb_basic_card_bg_color)); BaseCardView.LayoutParams lp = new BaseCardView.LayoutParams( c.getResources().getDimensionPixelSize(R.dimen.details_weblink_width), c.getResources().getDimensionPixelSize(R.dimen.details_weblink_height)); lp.viewType = BaseCardView.LayoutParams.VIEW_TYPE_MAIN; mCard.addView(mPlaceholder, lp); if(DBG) Log.d(TAG, "Launching delayed creation of webview in " + mCard + " for " + this); mWebViewDelayedInitTask = new WebViewDelayedInitTask(mCard, mPlaceholder).execute(); }
RecordingCardView(Context context, int imageWidth, int imageHeight) { super(context); //TODO(dvr): move these to the layout XML. setCardType(BaseCardView.CARD_TYPE_INFO_UNDER_WITH_EXTRA); setInfoVisibility(BaseCardView.CARD_REGION_VISIBLE_ALWAYS); setFocusable(true); setFocusableInTouchMode(true); mDefaultImage = getResources().getDrawable(R.drawable.dvr_default_poster, null); LayoutInflater inflater = LayoutInflater.from(getContext()); inflater.inflate(R.layout.dvr_recording_card_view, this); mImageView = (ImageView) findViewById(R.id.image); mImageWidth = imageWidth; mImageHeight = imageHeight; mProgressBar = (ProgressBar) findViewById(R.id.recording_progress); mAffiliatedIconContainer = findViewById(R.id.affiliated_icon_container); mAffiliatedIcon = (ImageView) findViewById(R.id.affiliated_icon); mTitleView = (TextView) findViewById(R.id.title); mMajorContentView = (TextView) findViewById(R.id.content_major); mMinorContentView = (TextView) findViewById(R.id.content_minor); }
public ViewHolder(ViewGroup parent) { super(new BaseCardView(parent.getContext())); mCardView = (BaseCardView)view; LayoutInflater.from(parent.getContext()).inflate(R.layout.leanback_row_emptyview, (ViewGroup)mCardView); mTextView = (TextView)mCardView.findViewById(R.id.text); mCardView.setClickable(false); mCardView.setFocusable(true); mCardView.setFocusableInTouchMode(true); mCardView.setBackgroundColor(Color.TRANSPARENT); }
public VideoViewHolder(Context context) { super(new ImageCardView(context)); mCardView = (ImageCardView)view; mCardView.setMainImageDimensions(getWidth(context), getHeight(context)); mCardView.setMainImage(new ColorDrawable(context.getResources().getColor(R.color.lb_basic_card_bg_color))); mCardView.setFocusable(true); mCardView.setFocusableInTouchMode(true); mWatchedMessage = (TextView)LayoutInflater.from(mContext).inflate(R.layout.leanback_season_watched_text, mCardView, false); BaseCardView.LayoutParams cardLp = new BaseCardView.LayoutParams(mWatchedMessage.getLayoutParams()); cardLp.viewType = BaseCardView.LayoutParams.VIEW_TYPE_INFO; mCardView.addView(mWatchedMessage, cardLp); mImageCardViewTarget = new PicassoImageCardViewTarget(mCardView); }
public BoxViewHolder(ViewGroup parent) { super(new CustomBaseCardview(parent.getContext())); mCard = (BaseCardView)view; mCard.setFocusable(true); mCard.setFocusableInTouchMode(true); mRoot = (ViewGroup)LayoutInflater.from(parent.getContext()).inflate(R.layout.leanback_box, mCard, false); mImageViewContainer = (ViewGroup)mRoot.findViewById(R.id.image_container); mImageView = (ImageView)mImageViewContainer.findViewById(R.id.image); mTextView = (TextView)mRoot.findViewById(R.id.name); BaseCardView.LayoutParams lp = new BaseCardView.LayoutParams(mRoot.getLayoutParams()); lp.viewType = BaseCardView.LayoutParams.VIEW_TYPE_MAIN; mCard.addView(mRoot); }
@Override public ViewHolder onCreateViewHolder(ViewGroup parent) { mContext = parent.getContext(); ImageCardView cardView = new ImageCardView(mContext); cardView.setCardType(BaseCardView.CARD_TYPE_INFO_UNDER); cardView.setInfoVisibility(BaseCardView.CARD_REGION_VISIBLE_ALWAYS); cardView.setFocusable(true); cardView.setFocusableInTouchMode(true); cardView.setBackgroundColor(ActivityCompat.getColor(mContext, R.color.default_background)); return new ViewHolder(cardView); }
public MoreCardView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); LayoutInflater inflater = LayoutInflater.from(context); View v = inflater.inflate(R.layout.more_card_view, this); ButterKnife.bind(this, v); setBackgroundResource(R.color.default_background); setCardType(BaseCardView.CARD_TYPE_INFO_UNDER); setInfoVisibility(BaseCardView.CARD_REGION_VISIBLE_ALWAYS); setFocusable(true); setFocusableInTouchMode(true); setOnFocusChangeListener(this); }
@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; }
@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()); }
public CustomImageCardView(Context context) { super(context); setInfoVisibility(BaseCardView.CARD_REGION_VISIBLE_ALWAYS); }
public CustomImageCardView(Context context, AttributeSet attrs) { super(context, attrs); setInfoVisibility(BaseCardView.CARD_REGION_VISIBLE_ALWAYS); }
public CustomImageCardView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); setInfoVisibility(BaseCardView.CARD_REGION_VISIBLE_ALWAYS); }
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); } }); }