Пример #1
0
        public void Initialize(AddNewCall_AdapterViewHolder holder, Classes.UserContacts.User item)
        {
            try
            {
                ImageCacheLoader.LoadImage(item.Avatar, holder.ImageAvatar, false, true);



                string name = IMethods.Fun_String.DecodeString(item.Name);
                holder.Txt_Username.Text = IMethods.Fun_String.SubStringCutOf(name, 25);

                if (item.UserPlatform == null)
                {
                    item.UserPlatform = "web";
                }

                //User platform
                if (item.UserPlatform.Contains("phone"))
                {
                    holder.Txt_platform.Text = this.Activity_Context.GetString(Resource.String.Lbl_Phone);
                }
                else if (item.UserPlatform.Contains("web"))
                {
                    holder.Txt_platform.Text = this.Activity_Context.GetString(Resource.String.Lbl_Web);
                }
                else
                {
                    holder.Txt_platform.Text = this.Activity_Context.GetString(Resource.String.Lbl_Web);
                }

                //Online Or offline
                if (item.Lastseen == "on")
                {
                    holder.Image_Lastseen.SetImageResource(Resource.Drawable.Green_Online);
                    if (AppSettings.Show_Online_Oflline_Message)
                    {
                        var data = listOnline.Contains(item.Name);
                        if (data == false)
                        {
                            listOnline.Add(item.Name);

                            Toast toast = Toast.MakeText(Activity_Context, item.Name + " " + this.Activity_Context.GetString(Resource.String.Lbl_Online), ToastLength.Short);
                            toast.SetGravity(GravityFlags.Center, 0, 0);
                            toast.Show();
                        }
                    }
                }
                else
                {
                    holder.Image_Lastseen.SetImageResource(Resource.Drawable.Grey_Offline);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Пример #2
0
 // Create new views (invoked by the layout manager)
 public override RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType)
 {
     try
     {
         //Setup your layout here >> AddNewCall_view
         var itemView = LayoutInflater.From(parent.Context).Inflate(Resource.Layout.AddNewCall_view, parent, false);
         var holder   = new AddNewCall_AdapterViewHolder(itemView, OnClick, OnLongClick, AudioCallOnClick, VideoCallOnClick);
         return(holder);
     }
     catch (Exception exception)
     {
         Console.WriteLine(exception);
         return(null);
     }
 }