public override RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType) { View itemView = LayoutInflater.From(parent.Context). Inflate(Resource.Layout.CardAddNewGroup, parent, false); NewGroupViewHolder vh = new NewGroupViewHolder(itemView, OnClick); return(vh); }
public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position) { NewGroupViewHolder vh = holder as NewGroupViewHolder; if (userGroups[position].Photo != null) { byte[] imageAsBytes = Android.Util.Base64.Decode(userGroups[position].Photo, Android.Util.Base64Flags.Default); activity.RunOnUiThread(() => { Bitmap bMap = BitmapFactory.DecodeByteArray(imageAsBytes, 0, imageAsBytes.Length); var d = new CircleDrawable(bMap); vh.Image.SetBackgroundDrawable(d); }); } else { vh.Image.SetBackgroundResource(Resource.Drawable.avatar_upload); vh.Image.SetImageResource(Resource.Drawable.circle); } if (vh.Phone != null) { vh.Phone.Text = userGroups[position].Phone; } //is Group@ if (userGroups[position].username.Contains('@')) { vh.Name.Text = userGroups[position].username.Split('@')[0]; } else { vh.Name.Text = userGroups[position].username; } if (userGroups[position].isCheck) { vh.Check.Checked = true; } else { vh.Check.Checked = false; } vh.Image.RefreshDrawableState(); vh.Check.RefreshDrawableState(); }