// Fill in the contents of the photo card (invoked by the layout manager): public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position) { vh = holder as CommentSystemRecyclerViewHolder; if (_commentList[position].Creator != null) { vh.CreatorNameTextView.Text = _commentList[position].Creator.Name; } else { vh.CreatorNameTextView.Text = _commentList[position].CommenterName; } vh.CommentTextView.Text = _commentList[position].CommentText; if (_commentList[position].CommenterAvatarDrawable != null) { vh.CreatorAvatar.SetImageDrawable(_commentList[position].CommenterAvatarDrawable); } else if (_commentList[position].Creator != null) { if (_commentList[position].Creator.CreatorThumbnailDrawable != null) { vh.CreatorAvatar.SetImageDrawable(_commentList[position].Creator.CreatorThumbnailDrawable); } } }
// Create a new photo CardView (invoked by the layout manager): public override RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType) { // Inflate the CardView for the photo: View itemView = LayoutInflater.From(parent.Context). Inflate(Resource.Layout.CommentCardViewReplies, parent, false); CardView cv = itemView.FindViewById <CardView>(Resource.Id.commentCardViewWithReply); cv.SetBackgroundColor(AppState.Display.DarkGrey); vh = new CommentSystemRecyclerViewHolder(itemView, OnClick, AvatarOnClick, ReplyButtonOnClick); return(vh); }