Exemple #1
0
        private void Initialize(ContactsAdapterViewHolder holder, UserDataObject users)
        {
            try
            {
                GlideImageLoader.LoadImage(ActivityContext, users.Avatar, holder.Image, ImageStyle.CircleCrop, ImagePlaceholders.Drawable);

                holder.Name.Text = Methods.FunString.SubStringCutOf(AppTools.GetNameFinal(users), 25);

                if (Type == TypeTextSecondary.None)
                {
                    holder.About.Visibility = ViewStates.Gone;
                }
                else
                {
                    holder.About.Text = Type == TypeTextSecondary.About ? Methods.FunString.SubStringCutOf(AppTools.GetAboutFinal(users), 25) : ActivityContext.GetString(Resource.String.Lbl_Last_seen) + " " + Methods.Time.TimeAgo(int.Parse(users.LastSeen));
                }

                if (ShowButton)
                {
                    switch (users.IsFollowing)
                    {
                    // My Friend
                    case true:
                    {
                        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";
                        break;
                    }

                    case false:
                    {
                        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";
                        break;
                    }
                    }

                    if (users.UserId.ToString() == UserDetails.UserId)
                    {
                        holder.Button.Visibility = ViewStates.Gone;
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Exemple #2
0
 // Create new views (invoked by the layout manager)
 public override RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType)
 {
     try
     {
         //Setup your layout here >> Style_HContact_view
         var itemView = LayoutInflater.From(parent.Context)
                        .Inflate(Resource.Layout.Style_HContact_view, parent, false);
         var vh = new ContactsAdapterViewHolder(itemView, Click, LongClick);
         return(vh);
     }
     catch (Exception exception)
     {
         Console.WriteLine(exception);
         return(null);
     }
 }