예제 #1
0
        OnCreateViewHolder(ViewGroup parent, int viewType)
        {
            //// Inflate the CardView for the photo:
            //View itemView = LayoutInflater.From(parent.Context).
            //            Inflate(Resource.Layout.ContactListItem, parent, false);



            //ContactListHolder vh = new ContactListHolder(itemView, OnClick);



            //return vh;

            RecyclerView.ViewHolder viewHolder = null;
            LayoutInflater          inflater   = LayoutInflater.From(parent.Context);


            switch (viewType)
            {
            case 0:
                View v1 = inflater.Inflate(Resource.Layout.AddNewGroupListItem, parent, false);
                viewHolder = new AddNewGroupListItemViewHolder(v1, OnClickFirst);
                break;

            case 1:

                View v2 = inflater.Inflate(Resource.Layout.ContactListItem, parent, false);
                viewHolder = new ContactListHolder(v2, OnClick);
                break;
            }
            return(viewHolder);
        }
예제 #2
0
        OnBindViewHolder(RecyclerView.ViewHolder holder, int position)
        {
            switch (position)
            {
            case 0:
                AddNewGroupListItemViewHolder vhAddNewGroup = holder as AddNewGroupListItemViewHolder;
                break;

            default:

                ContactListHolder vhContact = holder as ContactListHolder;
                var item = searchContact[position];
                vhContact.txtSenderName.Text = item.name;

                if (item.contactPicUrl != null)
                {
                    CommonHelper.SetImageOnUIImageView(vhContact.imgMessagelogo, item.contactPicUrl, context, 400, 400);
                }
                break;
            }
        }