public override RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType) { itemView = LayoutInflater.From(parent.Context).Inflate(Resource.Layout.TestSummary_row, parent, false); SummaryViewHolder vh = new SummaryViewHolder(itemView, OnClick, mRecyclerView); return(vh); }
public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position) { int answeredquestion = 0; int unsweredquestion = 0; int markforreview = 0; int unseenquestion = 0; string title = ""; if (portal_or_local.Equals("portal")) { txtrank.Text = "Current Rank : " + listTestSummaryModal[position].Rank + ""; title = listTestSummaryModal[position].Title; try { answeredquestion = listTestSummaryModal[position].Answered; } catch (Exception) { answeredquestion = 0; } try { unsweredquestion = listTestSummaryModal[position].NotAnswered; } catch (Exception) { unsweredquestion = 0; } try { unseenquestion = listTestSummaryModal[position].NotVisited; } catch (Exception) { unseenquestion = 0; } } else { title = items[position]; int startinpoint = startingquestionposition[position]; int endpoint; if (position < items.Count - 1) { endpoint = startingquestionposition[position + 1]; } else { endpoint = Alllist.Count; } for (int i = startinpoint; i < endpoint; i++) { List <questionmodel> question = Alllist[i]; for (int y = 0; y < question.Count; y++) { if (question[y].Datatype == 1) { if (question[y].selectedoption == 0 && question[y].colorcode == Resource.Drawable.whitecircle1) { unseenquestion = unseenquestion + 1; } else if (question[y].colorcode == Resource.Drawable.redcircle) { unsweredquestion = unsweredquestion + 1; } else if (question[y].selectedoption == 0 && question[y].markforreview == 1) { markforreview = markforreview + 1; } else if (question[y].selectedoption > 0) { answeredquestion = answeredquestion + 1; if (question[y].markforreview == 1) { markforreview = markforreview + 1; } } break; } else { continue; } } } } SummaryViewHolder photoViewHolder = holder as SummaryViewHolder; photoViewHolder.title.Text = title; photoViewHolder.answerd.Text = answeredquestion + ""; photoViewHolder.unanswerd.Text = unsweredquestion + ""; photoViewHolder.reviewd.Text = markforreview + ""; photoViewHolder.notvisited.Text = unseenquestion + ""; Animation animation = AnimationUtils.LoadAnimation(activity, (position > lastPosition) ? Resource.Animation.slide_up : Resource.Animation.slide_up); photoViewHolder.ItemView.StartAnimation(animation); lastPosition = position; }