コード例 #1
0
 // Create new views (invoked by the layout manager)
 public override RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType)
 {
     try
     {
         //Setup your layout here >> Style_HContactView
         View itemView = LayoutInflater.From(parent.Context).Inflate(Resource.Layout.Style_HContactView, parent, false);
         var  vh       = new ContactsAdapterViewHolder(itemView, OnClick, OnLongClick);
         return(vh);
     }
     catch (Exception exception)
     {
         Console.WriteLine(exception);
         return(null);
     }
 }
コード例 #2
0
        public void Initialize(ContactsAdapterViewHolder holder, UserDataObject following)
        {
            try
            {
                GlideImageLoader.LoadImage(ActivityContext, following.Avatar, holder.Image, ImageStyle.CircleCrop, ImagePlaceholders.Drawable);

                string name = Methods.FunString.DecodeString(DeepSoundTools.GetNameFinal(following));
                holder.Name.Text = Methods.FunString.SubStringCutOf(name, 25);

                holder.About.Text = Methods.Time.TimeAgo(Convert.ToInt32(following.LastActive), false);

                if (ShowButtonFollow)
                {
                    if (following.Id == UserDetails.UserId)
                    {
                        holder.Button.Visibility = ViewStates.Invisible;
                    }
                    else
                    {
                        if (following.IsFollowing != null && following.IsFollowing.Value) // My Friend
                        {
                            holder.Button.SetBackgroundResource(Resource.Xml.background_signup2);
                            holder.Button.SetTextColor(Color.ParseColor("#ffffff"));
                            holder.Button.Text = ActivityContext.GetText(Resource.String.Lbl_Following);

                            holder.Button.Tag = "true";
                        }
                        else //Not Friend
                        {
                            holder.Button.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends);
                            holder.Button.SetTextColor(Color.ParseColor(AppSettings.MainColor));
                            holder.Button.Text = ActivityContext.GetText(Resource.String.Lbl_Follow);
                            holder.Button.Tag  = "false";
                        }
                    }
                }
                else
                {
                    holder.Button.Visibility = ViewStates.Invisible;
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }