Beispiel #1
0
        public override RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType)
        {
            // Inflate the CardView for the photo:
            View itemView = LayoutInflater.From(parent.Context).Inflate(Resource.Layout.gameCardLayout, parent, false);

            // Create a ViewHolder to hold view references inside the CardView:
            GameAdapterViewHolder vh = new GameAdapterViewHolder(itemView, OnClick, OnLongClick);

            return(vh);
        }
Beispiel #2
0
        public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position)
        {
            GameAdapterViewHolder vh = holder as GameAdapterViewHolder;

            var item = Games.ElementAt(position);

            vh.NoteProgressBar.Progress = item.Score;
            vh.NoteProgressBar.Max      = item.Total;
            vh.Name.Text   = item.Name;
            vh.Result.Text = string.Format("{0}/{1}", item.Score, item.Total);

            //float percentage = ((float)item.Score / (float)item.Total) * 100;
            //var currentColor = ColorHelper.GetBlendedColor(percentage);
            //Drawable progressDrawable = vh.NoteProgressBar.ProgressDrawable.Mutate();
            //progressDrawable.SetColorFilter(currentColor, PorterDuff.Mode.SrcIn);
        }