public void OnClick(View view) { TimeStepViewHolder viewHolder = viewHolders.First(vh => vh.ItemView == view); TimeStep timeStep = timeSteps[viewHolder.AdapterPosition]; Intent intent = new Intent(view.Context, typeof(LineActivity)); intent.PutExtra("Line", timeStep.Step.Route.Line.Id); intent.PutExtra("Route", timeStep.Step.Route.Id); view.Context.StartActivity(intent); }
public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position) { TimeStepViewHolder viewHolder = holder as TimeStepViewHolder; TimeStep timeStep = timeSteps[position]; viewHolder.Icon.SetImageDrawable(timeStep.Step.Route.Line.GetIconDrawable(viewHolder.ItemView.Context)); viewHolder.Name.Text = timeStep.Destination?.Stop?.Name ?? ""; viewHolder.Description.Text = Utils.GetReadableTime(timeStep, DateTime.Now); if (!viewHolders.Contains(viewHolder)) { viewHolders.Add(viewHolder); } }