/*********************************************************************/ /* Create the viewholder */ /*********************************************************************/ public override RecyclerView.ViewHolder OnCreateViewHolder( ViewGroup parent, int viewType) { /* Inflate the cardview */ View view = LayoutInflater.From(parent.Context).Inflate( Resource.Layout.AnnouncementCardLayout, parent, false); /* Create a viewholder to hold view references inside the */ /* cardview */ RecyclerView.ViewHolder _viewHolder = new announcementViewHolder(view); /* Get the current ViewHolder */ #region NOTE // NOTE: keep this as a local variable #endregion announcementViewHolder _currentHolder = _viewHolder as announcementViewHolder; /* Expand the touchable area of all views with the specified */ /* tag name */ #region NOTE // NOTE: Eventually ExpandTouchableByTagName() will not have to take the // direct parent layout as a parameter. Recursion can be used to loop // through the views and find them by tag name. Once this is implemented, // the ROOT VIEW can be used as the parameter // NOTE: THREADING DOES NOT WORK HERE #endregion //ExpandTouchableByTagName(_currentHolder.ParentLayout, "ExpandTouchable"); return(_viewHolder); }
/*********************************************************************/ /* Bind the layout views to the viewholder */ /*********************************************************************/ public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position) { /* Find the current card based off of its position in the */ /* recyclerview and set its title and image */ Card card = Announcements[position]; CurrentHolder = holder as announcementViewHolder; _context.RunOnUiThread(() => CurrentHolder.BindCard(card)); }