Exemplo n.º 1
0
        public override RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType)
        {
            View itemView = LayoutInflater.From(parent.Context).
                            Inflate(Resource.Layout.item_user, parent, false);

            UserScoreViewHolder vh = new UserScoreViewHolder(itemView);

            return(vh);
        }
Exemplo n.º 2
0
        public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position)
        {
            UserScoreViewHolder vh = holder as UserScoreViewHolder;

            if (vh == null)
            {
                return;
            }
            UserScore userScore = _mGame.scores[position];

            vh.TvUserName.Text = userScore.user.name;
            vh.TvWins.Text     = userScore.user.winCount.ToString();
            vh.TvLoss.Text     = userScore.user.lossCount.ToString();
            Glide
            .With(_mContext)
            .Load(userScore.user.profileUrl)
            .Apply(RequestOptions.CenterCropTransform()).Into(vh.IvUserProfile);

            GridLayoutManager layoutManager = new GridLayoutManager(_mContext.Context, 3);

            layoutManager.SetSpanSizeLookup(new ScoreSpanSizeLookup(userScore.scores.Count));
            vh.RvUserScore.SetLayoutManager(layoutManager);
            vh.RvUserScore.SetAdapter(new ScoreAdapter(_mContext, userScore));
        }