Ejemplo n.º 1
0
 // Create new views (invoked by the layout manager)
 public override RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType)
 {
     try
     {
         //Setup your layout here >> BlockedUsers_view
         var itemView = LayoutInflater.From(parent.Context).Inflate(Resource.Layout.BlockedUsers_view, parent, false);
         var vh       = new BlockedUsers_AdapterViewHolder(itemView, OnClick, OnLongClick);
         return(vh);
     }
     catch (Exception exception)
     {
         Crashes.TrackError(exception);
         return(null);
     }
 }
Ejemplo n.º 2
0
        public void Initialize(BlockedUsers_AdapterViewHolder holder, Get_Blocked_Users_Object.Blocked_Users users)
        {
            try
            {
                var AvatarSplit     = users.avatar.Split('/').Last();
                var getImage_Avatar = IMethods.MultiMedia.GetMediaFrom_Disk(IMethods.IPath.FolderDiskImage, AvatarSplit);
                if (getImage_Avatar != "File Dont Exists")
                {
                    if (holder.ImageAvatar.Tag?.ToString() != "loaded")
                    {
                        ImageServiceLoader.Load_Image(holder.ImageAvatar, "no_profile_image.png", getImage_Avatar, 1);
                        holder.ImageAvatar.Tag = "loaded";
                    }
                }
                else
                {
                    if (holder.ImageAvatar.Tag?.ToString() != "loaded")
                    {
                        IMethods.MultiMedia.DownloadMediaTo_DiskAsync(IMethods.IPath.FolderDiskImage, users.avatar);
                        ImageServiceLoader.Load_Image(holder.ImageAvatar, "no_profile_image.png", users.avatar, 1);
                        holder.ImageAvatar.Tag = "loaded";
                    }
                }

                string name = IMethods.Fun_String.DecodeString(IMethods.Fun_String.DecodeStringWithEnter(users.name));

                holder.Txt_Username.Text = name;

                string lastSeen = Activity_Context.GetText(Resource.String.Lbl_Last_seen);

                var time = users.lastseen_time_text;
                if (time.Contains("hours ago"))
                {
                    holder.Txt_Lastseen.Text = lastSeen + " " + time.Replace("hours ago", Activity_Context.GetText(Resource.String.Lbl_hours));
                }
                else if (time.Contains("days ago"))
                {
                    holder.Txt_Lastseen.Text = lastSeen + " " + time.Replace("days ago", Activity_Context.GetText(Resource.String.Lbl_days));
                }
                else if (time.Contains("month ago"))
                {
                    holder.Txt_Lastseen.Text = lastSeen + " " + time.Replace("month ago", Activity_Context.GetText(Resource.String.Lbl_month));
                }
                else if (time.Contains("months ago"))
                {
                    holder.Txt_Lastseen.Text = lastSeen + " " + time.Replace("months ago", Activity_Context.GetText(Resource.String.Lbl_month));
                }
                else if (time.Contains("day ago"))
                {
                    holder.Txt_Lastseen.Text = lastSeen + " " + time.Replace("day ago", Activity_Context.GetText(Resource.String.Lbl_days));
                }
                else if (time.Contains("minutes ago"))
                {
                    holder.Txt_Lastseen.Text = lastSeen + " " + time.Replace("minutes ago", Activity_Context.GetText(Resource.String.Lbl_minutes));
                }
                else if (time.Contains("minute ago"))
                {
                    holder.Txt_Lastseen.Text = lastSeen + " " + time.Replace("minute ago", Activity_Context.GetText(Resource.String.Lbl_minutes));
                }
                else if (time.Contains("seconds ago"))
                {
                    holder.Txt_Lastseen.Text = lastSeen + " " + time.Replace("seconds ago", Activity_Context.GetText(Resource.String.Lbl_seconds));
                }
                else if (time.Contains("hour ago"))
                {
                    holder.Txt_Lastseen.Text = lastSeen + " " + time.Replace("hour ago", Activity_Context.GetText(Resource.String.Lbl_hours));
                }
                else
                {
                    holder.Txt_Lastseen.Text = lastSeen + " " + time;
                }
            }
            catch (Exception e)
            {
                Crashes.TrackError(e);
            }
        }