public override void OnBindViewHolder(RecyclerView.ViewHolder vh, int position)
        {
            try
            {
                int type = GetItemViewType(position);
                var item = MessageList[type];
                if (item == null)
                {
                    return;
                }
                switch (item.MessageType)
                {
                case "text":
                {
                    TextViewHolder holder = vh as TextViewHolder;
                    LoadTextOfChatItem(holder, position, item);
                    break;
                }

                case "media":
                {
                    ImageViewHolder holder = vh as ImageViewHolder;
                    LoadImageOfChatItem(holder, position, item);
                    break;
                }

                case "sticker" when item.Sticker.Contains(".gif"):
                {
                    GifViewHolder holder = vh as GifViewHolder;
                    LoadGifOfChatItem(holder, position, item);
                    break;
                }

                case "sticker":
                {
                    StickerViewHolder holder = vh as StickerViewHolder;
                    LoadStickerOfChatItem(holder, position, item);
                    break;
                }
                }
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
            }
        }
        public override RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType)
        {
            try
            {
                //Setup your layout here >>
                var itemView = MessageList[viewType];
                if (itemView != null)
                {
                    if (itemView.From == UserDetails.UserId && itemView.MessageType == "text")
                    {
                        View           row            = LayoutInflater.From(parent.Context).Inflate(Resource.Layout.Right_MS_view, parent, false);
                        TextViewHolder textViewHolder = new TextViewHolder(row, ActivityContext);
                        return(textViewHolder);
                    }

                    if (itemView.To == UserDetails.UserId && itemView.MessageType == "text")
                    {
                        View           row            = LayoutInflater.From(parent.Context).Inflate(Resource.Layout.Left_MS_view, parent, false);
                        TextViewHolder textViewHolder = new TextViewHolder(row, ActivityContext);
                        return(textViewHolder);
                    }
                    if (itemView.From == UserDetails.UserId && itemView.MessageType == "media")
                    {
                        View            row             = LayoutInflater.From(parent.Context).Inflate(Resource.Layout.Right_MS_image, parent, false);
                        ImageViewHolder imageViewHolder = new ImageViewHolder(row);
                        return(imageViewHolder);
                    }
                    if (itemView.To == UserDetails.UserId && itemView.MessageType == "media")
                    {
                        View            row             = LayoutInflater.From(parent.Context).Inflate(Resource.Layout.Left_MS_image, parent, false);
                        ImageViewHolder imageViewHolder = new ImageViewHolder(row);
                        return(imageViewHolder);
                    }
                    if (itemView.From == UserDetails.UserId && itemView.MessageType == "sticker")
                    {
                        if (itemView.Sticker.Contains(".gif"))
                        {
                            View          row        = LayoutInflater.From(parent.Context).Inflate(Resource.Layout.Right_MS_gif, parent, false);
                            GifViewHolder viewHolder = new GifViewHolder(row);
                            return(viewHolder);
                        }
                        else
                        {
                            View row = LayoutInflater.From(parent.Context).Inflate(Resource.Layout.Right_MS_sticker, parent, false);
                            StickerViewHolder stickerViewHolder = new StickerViewHolder(row);
                            return(stickerViewHolder);
                        }
                    }
                    if (itemView.To == UserDetails.UserId && itemView.MessageType == "sticker")
                    {
                        if (itemView.Sticker.Contains(".gif"))
                        {
                            View          row        = LayoutInflater.From(parent.Context).Inflate(Resource.Layout.Left_MS_gif, parent, false);
                            GifViewHolder viewHolder = new GifViewHolder(row);
                            return(viewHolder);
                        }
                        else
                        {
                            View row = LayoutInflater.From(parent.Context).Inflate(Resource.Layout.Left_MS_sticker, parent, false);
                            StickerViewHolder stickerViewHolder = new StickerViewHolder(row);
                            return(stickerViewHolder);
                        }
                    }

                    return(null);
                }

                return(null);
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
                return(null);
            }
        }
        private void LoadImageOfChatItem(ImageViewHolder holder, int position, GetChatConversationsObject.Messages message)
        {
            try
            {
                string imageUrl = message.Media.Contains("upload/chat/") && !message.Media.Contains(Client.WebsiteUrl) ? Client.WebsiteUrl + "/" + message.Media : message.Media;

                string fileSavedPath;

                try
                {
                    DateTime time = Methods.Time.UnixTimeStampToDateTime(int.Parse(message.CreatedAt));
                    holder.Time.Text = time.ToShortTimeString();
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                }

                if (imageUrl.Contains("http://") || imageUrl.Contains("https://"))
                {
                    var    fileName  = imageUrl.Split('/').Last();
                    string imageFile = Methods.MultiMedia.GetMediaFrom_Gallery(Methods.Path.FolderDcimImage, fileName);
                    if (imageFile == "File Dont Exists")
                    {
                        holder.LoadingProgressView.Indeterminate = false;
                        holder.LoadingProgressView.Visibility    = ViewStates.Visible;

                        string filePath  = Path.Combine(Methods.Path.FolderDcimImage);
                        string mediaFile = filePath + "/" + fileName;
                        fileSavedPath = mediaFile;

                        WebClient webClient = new WebClient();

                        webClient.DownloadDataAsync(new System.Uri(imageUrl));
                        webClient.DownloadProgressChanged += (sender, args) =>
                        {
                            var progress = args.ProgressPercentage;
                        };

                        webClient.DownloadDataCompleted += (s, e) =>
                        {
                            try
                            {
                                if (!Directory.Exists(filePath))
                                {
                                    Directory.CreateDirectory(filePath);
                                }

                                File.WriteAllBytes(mediaFile, e.Result);

                                //var mediaScanIntent = new Intent(Intent.ActionMediaScannerScanFile);
                                //mediaScanIntent.SetData(Android.Net.Uri.FromFile(new Java.IO.File(mediaFile)));
                                //ActivityContext.SendBroadcast(mediaScanIntent);

                                // Tell the media scanner about the new file so that it is
                                // immediately available to the user.
                                MediaScannerConnection.ScanFile(Application.Context, new[] { mediaFile }, null, null);

                                var file = Android.Net.Uri.FromFile(new Java.IO.File(mediaFile));
                                Glide.With(ActivityContext).Load(file.Path).Apply(Options).Into(holder.ImageView);

                                holder.LoadingProgressView.Indeterminate = false;
                                holder.LoadingProgressView.Visibility    = ViewStates.Gone;
                            }
                            catch (Exception ex)
                            {
                                Console.WriteLine(ex);
                            }
                        };
                    }
                    else
                    {
                        fileSavedPath = imageFile;

                        var file = Android.Net.Uri.FromFile(new Java.IO.File(imageFile));
                        Glide.With(ActivityContext).Load(file.Path).Apply(Options).Into(holder.ImageView);

                        holder.LoadingProgressView.Indeterminate = false;
                        holder.LoadingProgressView.Visibility    = ViewStates.Gone;
                    }
                }
                else
                {
                    fileSavedPath = imageUrl;

                    var file = Android.Net.Uri.FromFile(new Java.IO.File(imageUrl));
                    Glide.With(ActivityContext).Load(file.Path).Apply(Options).Into(holder.ImageView);

                    //GlideImageLoader.LoadImage(ActivityContext, imageUrl, holder.ImageView, ImageStyle.CenterCrop, ImagePlaceholders.Drawable);

                    holder.LoadingProgressView.Indeterminate = false;
                    holder.LoadingProgressView.Visibility    = ViewStates.Gone;
                }

                if (!holder.ImageView.HasOnClickListeners)
                {
                    holder.ImageView.Click += (sender, args) =>
                    {
                        try
                        {
                            string imageFile = Methods.MultiMedia.CheckFileIfExits(fileSavedPath);
                            if (imageFile != "File Dont Exists")
                            {
                                Java.IO.File file2    = new Java.IO.File(fileSavedPath);
                                var          photoUri = FileProvider.GetUriForFile(ActivityContext, ActivityContext.PackageName + ".fileprovider", file2);
                                Intent       intent   = new Intent();
                                intent.SetAction(Intent.ActionView);
                                intent.AddFlags(ActivityFlags.GrantReadUriPermission);
                                intent.SetDataAndType(photoUri, "image/*");
                                ActivityContext.StartActivity(intent);
                            }
                            else
                            {
                                Intent intent = new Intent(Intent.ActionView, Uri.Parse(imageUrl));
                                ActivityContext.StartActivity(intent);
                            }
                        }
                        catch (Exception e)
                        {
                            Console.WriteLine(e);
                        }
                    };
                }

                holder.LytParent.Activated = SelectedItems.Get(position, false);
                if (!holder.LytParent.HasOnClickListeners)
                {
                    holder.LytParent.Click += delegate
                    {
                        try
                        {
                            if (ClickListener == null)
                            {
                                return;
                            }

                            ClickListener.ItemClick(holder.LytParent, message, position);
                        }
                        catch (Exception e)
                        {
                            Console.WriteLine(e);
                        }
                    };

                    holder.LytParent.LongClick += delegate
                    {
                        try
                        {
                            if (ClickListener == null)
                            {
                                return;
                            }

                            ClickListener.ItemLongClick(holder.LytParent, message, position);
                        }
                        catch (Exception e)
                        {
                            Console.WriteLine(e);
                        }
                    };
                }


                ToggleCheckedBackground(holder, position);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }