//BoostPost
        private async void BoostPostEvent(PostsObject item)
        {
            try
            {
                if (Methods.CheckConnectivity())
                {
                    item.Boosted = "1";
                    Toast.MakeText(MainContext, MainContext.GetText(Resource.String.Lbl_postSuccessfullyBoosted), ToastLength.Short).Show();
                    //Sent Api >>
                    var(apiStatus, respond) = await RequestsAsync.Post.BoostPost(item.PostId.ToString()).ConfigureAwait(false);

                    if (apiStatus == 200)
                    {
                        if (respond is AddBoostPostObject actionsObject)
                        {
                            item.Boosted = actionsObject.Code;
                        }
                    }
                }
                else
                {
                    Toast.MakeText(MainContext, MainContext.GetText(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short).Show();
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
        //Copy
        public void OnMenuCopyOnClick(PostsObject feed)
        {
            try
            {
                ClipboardManager clipboard = (ClipboardManager)MainContext.GetSystemService(Context.ClipboardService);
                ClipData         clip      = ClipData.NewPlainText("clipboard", feed.Link);
                clipboard.PrimaryClip = clip;

                Toast.MakeText(MainContext, MainContext.GetText(Resource.String.Lbl_Text_copied), ToastLength.Short).Show();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Exemple #3
0
        public static NativeFeedType GetPostType(PostsObject item)
        {
            try
            {
                switch (item.Type)
                {
                case "video":
                case "Video":
                    return(NativeFeedType.Video);

                case "youtube":
                case "Youtube":
                case "EmbedVideo":
                    return(NativeFeedType.Youtube);

                case "gif":
                case "Gif":
                    return(NativeFeedType.Gif);

                case "Funding":
                    return(NativeFeedType.Funding);

                case "AdMob":
                    return(NativeFeedType.AdMob);

                default:
                {
                    if (item.Type == "image" || item.Type == "Image")
                    {
                        return(item.MediaSet.Count > 1 ? NativeFeedType.MultiPhoto : NativeFeedType.Photo);
                    }
                    else
                    {
                        return(NativeFeedType.Photo);
                    }
                }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                return(NativeFeedType.Photo);
            }
        }
Exemple #4
0
 public void GivenAUserIsUsingThePostsResource()
 {
     PostsObject = new PostsObject();
 }
Exemple #5
0
        public void PlayVideo(bool isEndOfList, Holders.VideoAdapterViewHolder holderVideoPlayer = null, PostsObject item = null)
        {
            try
            {
                if (VideoPlayer == null)
                {
                    SetPlayer();
                }

                int targetPosition;
                if (!isEndOfList)
                {
                    var startPosition = ((LinearLayoutManager)GetLayoutManager()).FindFirstVisibleItemPosition();
                    var endPosition   = ((LinearLayoutManager)GetLayoutManager()).FindLastVisibleItemPosition();

                    if (endPosition - startPosition > 1)
                    {
                        endPosition = startPosition + 1;
                    }

                    if (startPosition < 0 || endPosition < 0)
                    {
                        return;
                    }

                    if (startPosition != endPosition)
                    {
                        var startPositionVideoHeight = GetVisibleVideoSurfaceHeight(startPosition);
                        var endPositionVideoHeight   = GetVisibleVideoSurfaceHeight(endPosition);
                        targetPosition = startPositionVideoHeight > endPositionVideoHeight ? startPosition : endPosition;
                    }
                    else
                    {
                        targetPosition = startPosition;
                    }
                }
                else
                {
                    targetPosition = GetAdapter().ItemCount - 1;
                }


                if (targetPosition == PlayPosition)
                {
                    return;
                }

                // set the position of the list-item that is to be played
                PlayPosition = targetPosition;
                if (VideoSurfaceView == null)
                {
                    return;
                }

                VideoSurfaceView.Visibility = ViewStates.Invisible;
                RemoveVideoView(VideoSurfaceView);

                var currentPosition = targetPosition - ((LinearLayoutManager)GetLayoutManager()).FindFirstVisibleItemPosition();

                var child = GetChildAt(currentPosition);
                if (child == null)
                {
                    return;
                }

                dynamic holder;
                if (holderVideoPlayer != null)
                {
                    holder         = holderVideoPlayer;
                    targetPosition = holderVideoPlayer.LayoutPosition;
                }
                else
                {
                    Holders.VideoAdapterViewHolder holderChild = (Holders.VideoAdapterViewHolder)child.Tag;
                    if (holderChild == null)
                    {
                        PlayPosition = -1;
                        return;
                    }
                    else
                    {
                        targetPosition = holderChild.LayoutPosition;
                        holder         = holderChild;
                    }
                }

                if (!(holder is Holders.VideoAdapterViewHolder holderVideo))
                {
                    return;
                }
                MediaContainerLayout = holderVideo.MediaContainerLayout;
                Thumbnail            = holderVideo.VideoImage;


                ViewHolderParent = holderVideo.ItemView;
                PlayControl      = holderVideo.PlayControl;

                if (!IsVideoViewAdded)
                {
                    AddVideoView();
                }
                holderVideo.VideoProgressBar.Visibility = ViewStates.Visible;
                VideoSurfaceView.Player = VideoPlayer;

                var controlView = VideoSurfaceView.FindViewById <PlayerControlView>(Resource.Id.exo_controller);
                Uri videoUrl    = Uri.Parse(item != null ? item.MediaSet[0].File : NativeFeedAdapter.PixelNewsFeedList[targetPosition].MediaSet[0].File);

                //>> Old Code
                //===================== Exo Player ========================
                var lis = new ExoPlayerRecyclerEvent(controlView, this, holderVideo);

                IMediaSource videoSource = GetMediaSourceFromUrl(videoUrl, "normal");

                var dataSpec = new DataSpec(videoUrl); //0, 1000 * 1024, null

                if (Cache == null)
                {
                    CacheVideosFiles(videoUrl);
                }

                //Cache = new SimpleCache(new Java.IO.File(MainContext.FilesDir, "media"), new NoOpCacheEvictor());

                if (CacheDataSourceFactory == null)
                {
                    CacheDataSourceFactory = new CacheDataSourceFactory(Cache, DefaultDataSourceFac);
                }

                var counters = new CacheUtil.CachingCounters();

                CacheUtil.GetCached(dataSpec, Cache, counters);
                if (counters.ContentLength == counters.TotalCachedBytes())
                {
                    videoSource = new ExtractorMediaSource.Factory(CacheDataSourceFactory).CreateMediaSource(videoUrl);
                }
                else if (counters.TotalCachedBytes() == 0)
                {
                    videoSource = new ExtractorMediaSource.Factory(CacheDataSourceFactory).CreateMediaSource(videoUrl);
                    // not cached at all
                    Task.Run(() =>
                    {
                        try
                        {
                            var cacheDataSource = new CacheDataSource(Cache, CacheDataSourceFactory.CreateDataSource());
                            CacheUtil.Cache(dataSpec, Cache, cacheDataSource, counters, new AtomicBoolean());
                            double downloadPercentage = counters.TotalCachedBytes() * 100d / counters.ContentLength;
                            Console.WriteLine(downloadPercentage);
                        }
                        catch (Exception e)
                        {
                            Console.WriteLine(e);
                        }
                    });
                }
                else
                {
                    // partially cached
                    videoSource = new ExtractorMediaSource.Factory(CacheDataSourceFactory).CreateMediaSource(videoUrl);
                }

                lis.mFullScreenButton.SetOnClickListener(new NewClicker(lis.mFullScreenButton, videoUrl.ToString(), this));

                VideoPlayer.Prepare(videoSource);
                VideoPlayer.AddListener(lis);
                VideoPlayer.PlayWhenReady = true;
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Exemple #6
0
        //wael
        //public void SetXPopupBubble(PopupBubble popupBubble)
        //{
        //    PopupBubbleView = popupBubble;
        //    PopupBubbleView.SetRecyclerView(this);
        //    PopupBubbleView.SetPopupBubbleListener(new PopupBubbleClickEvent(this));
        //}

        public async Task FetchNewsFeedApiPosts(string typeRun, string offset, string limit)
        {
            try
            {
                if (!RunApi)
                {
                    return;
                }

                var countList = NativeFeedAdapter.PixelNewsFeedList.Count;

                var(respondCode, respondString) = await RequestsAsync.Post.FetchHomePosts(offset, limit);

                if (respondCode != 200 || !(respondString is FetchHomePostsObject Object))
                {
                    Methods.DisplayReportResult(HomeActivity.GetInstance(), respondString);
                }
                else
                {
                    if (respondCode.Equals(200))
                    {
                        var respondList = Object.PostList.Count;
                        if (respondList > 0)
                        {
                            Object.PostList.RemoveAll(a => a.MediaSet?.Count == 0 || a.MediaSet == null);

                            foreach (var item in from item in Object.PostList let check = NativeFeedAdapter.PixelNewsFeedList.FirstOrDefault(a => a.PostId == item.PostId) where check == null select item)
                            {
                                item.Mp4 = Methods.FunString.StringNullRemover(item.Mp4);

                                var checkType = NativeFeedAdapter.PixelNewsFeedList.LastOrDefault();

                                if (checkType?.Type == "video" || checkType?.Type == "Video")
                                {
                                    CacheVideosFiles(Uri.Parse(item.MediaSet[0].File));
                                }

                                if (NativeFeedAdapter.PixelNewsFeedList.Count > 0 && NativeFeedAdapter.PixelNewsFeedList.Count % AppSettings.ShowAdMobNativeCount == 0)
                                {
                                    if (AppSettings.ShowAdMobNative)
                                    {
                                        if (checkType?.Type != "AdMob")
                                        {
                                            var adMobBox = new PostsObject
                                            {
                                                Type = "AdMob",
                                            };

                                            NativeFeedAdapter.PixelNewsFeedList.Add(adMobBox);
                                        }
                                    }
                                }

                                if (AppSettings.ShowFunding && NativeFeedAdapter.PixelNewsFeedList.Count == 5)
                                {
                                    if (ListUtils.FundingList.Count > 0)
                                    {
                                        NativeFeedAdapter.PixelNewsFeedList.Add(new PostsObject()
                                        {
                                            Type = "Funding"
                                        });
                                    }
                                }

                                if (typeRun == "Add")
                                {
                                    NativeFeedAdapter.PixelNewsFeedList.Add(item);
                                }
                                else
                                {
                                    NativeFeedAdapter.PixelNewsFeedList.Insert(0, item);
                                }
                            }

                            if (countList > 0)
                            {
                                NativeFeedAdapter.NotifyItemRangeInserted(countList - 1, NativeFeedAdapter.PixelNewsFeedList.Count - countList);
                            }
                            else
                            {
                                NativeFeedAdapter.NotifyDataSetChanged();
                            }
                        }
                        else
                        {
                            if (NativeFeedAdapter.PixelNewsFeedList.Count > 10 && !CanScrollVertically(1))
                            {
                                Toast.MakeText(Context, Context.GetText(Resource.String.Lbl_NoMorePost), ToastLength.Short).Show();
                            }
                        }
                    }

                    MainScrollEvent.IsLoading = false;

                    var newsFeedFragment = HomeActivity.GetInstance()?.NewsFeedFragment;
                    if (newsFeedFragment != null)
                    {
                        HomeActivity.GetInstance()?.RunOnUiThread(newsFeedFragment.ShowEmptyPage);
                    }
                }
            }
            catch (Exception e)
            {
                MainScrollEvent.IsLoading = false;
                Console.WriteLine(e);
            }
        }
Exemple #7
0
        // Replace the contents of a view (invoked by the layout manager)
        public override void OnBindViewHolder(RecyclerView.ViewHolder viewHolder, int position)
        {
            try
            {
                if (viewHolder is UserPostAdapterViewHolder holder)
                {
                    PostsObject item = PostList[position];
                    if (item != null)
                    {
                        item.Mp4 = Methods.FunString.StringNullRemover(item.Mp4);

                        NativeFeedType type = NewsFeedAdapter.GetPostType(item);


                        if (type == NativeFeedType.Video)
                        {
                            FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, holder.PlayIcon, IonIconsFonts.Play);

                            if (holder.PlayIcon.Visibility != ViewStates.Visible)
                            {
                                holder.PlayIcon.Visibility = ViewStates.Visible;
                            }

                            FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, holder.TypeIcon, IonIconsFonts.Videocamera);

                            if (holder.TypeIcon.Visibility != ViewStates.Visible)
                            {
                                holder.TypeIcon.Visibility = ViewStates.Visible;
                            }
                        }
                        else if (type == NativeFeedType.Gif)
                        {
                            holder.TypeIcon.Text = ActivityContext.GetText(Resource.String.Lbl_Gif);
                            FontUtils.SetFont(holder.TypeIcon, Fonts.SfSemibold);

                            if (holder.TypeIcon.Visibility != ViewStates.Visible)
                            {
                                holder.TypeIcon.Visibility = ViewStates.Visible;
                            }
                        }
                        else if (type == NativeFeedType.Youtube)
                        {
                            FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, holder.PlayIcon, IonIconsFonts.Play);

                            if (holder.PlayIcon.Visibility != ViewStates.Visible)
                            {
                                holder.PlayIcon.Visibility = ViewStates.Visible;
                            }

                            FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, holder.TypeIcon, IonIconsFonts.SocialYoutube);

                            if (holder.TypeIcon.Visibility != ViewStates.Visible)
                            {
                                holder.TypeIcon.Visibility = ViewStates.Visible;
                            }
                        }


                        if (string.IsNullOrEmpty(item.MediaSet[0]?.Extra))
                        {
                            item.MediaSet[0].Extra = item.MediaSet[0]?.File;
                        }

                        if (type == NativeFeedType.Video)
                        {
                            if (!string.IsNullOrEmpty(item.MediaSet[0]?.Extra))
                            {
                                FullGlideRequestBuilder.Load(item.MediaSet[0]?.Extra).Into(holder.Image);
                            }
                            else
                            {
                                var fileName = item.MediaSet[0].File.Split('/').Last();
                                var fileNameWithoutExtension = fileName.Split('.').First();

                                item.MediaSet[0].Extra = Methods.Path.FolderDcimImage + "/" + fileNameWithoutExtension + ".png";

                                var vidoePlaceHolderImage = Methods.MultiMedia.GetMediaFrom_Gallery(Methods.Path.FolderDcimImage, fileNameWithoutExtension + ".png");
                                if (vidoePlaceHolderImage == "File Dont Exists")
                                {
                                    var bitmapImage = Methods.MultiMedia.Retrieve_VideoFrame_AsBitmap(ActivityContext, item.MediaSet[0]?.File);
                                    if (bitmapImage != null)
                                    {
                                        Methods.MultiMedia.Export_Bitmap_As_Image(bitmapImage, fileNameWithoutExtension, Methods.Path.FolderDcimImage);
                                        FullGlideRequestBuilder.Load(bitmapImage).Into(holder.Image);
                                    }
                                    else
                                    {
                                        Glide.With(ActivityContext)
                                        .AsBitmap()
                                        .Apply(new RequestOptions().Placeholder(Resource.Drawable.blackdefault).Error(Resource.Drawable.blackdefault))
                                        .Load(item.MediaSet[0]?.File) // or URI/path
                                        .Into(holder.Image);          //image view to set thumbnail to
                                    }
                                }
                                else
                                {
                                    FullGlideRequestBuilder.Load(vidoePlaceHolderImage).Into(holder.Image);
                                }
                            }
                        }
                        else
                        {
                            FullGlideRequestBuilder.Load(!string.IsNullOrEmpty(item.MediaSet[0].Extra) ? item.MediaSet[0].Extra : item.MediaSet[0].File).Into(holder.Image);
                            //GlideImageLoader.LoadImage(ActivityContext, !string.IsNullOrEmpty(item.MediaSet[0].Extra) ? item.MediaSet[0].Extra : item.MediaSet[0].File, holder.Image, ImageStyle.CenterCrop, ImagePlaceholders.Color);
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
            }
        }
Exemple #8
0
        public void SetDataDynamicForViewHolder(View itemView, TextView username, ImageView userAvatar, AutoLinkTextView description, TextView likeIcon, TextView favIcon, TextView commentCount, TextView likeCount, TextView viewMoreComments, TextView timeText, TextView commentIcon, TextView moreIcon, TextView shareIcon, TextView isBoostedIcon, PostsObject item)
        {
            try
            {
                if (item == null)
                {
                    return;
                }

                TextSanitizerAutoLink = new TextSanitizer(description, ActivityContext);

                GlideImageLoader.LoadImage(ActivityContext, item.Avatar, userAvatar, ImageStyle.CircleCrop, ImagePlaceholders.Drawable);

                username.Text = item.Username;

                string time = Methods.Time.TimeAgo(Convert.ToInt32(item.Time));
                timeText.Text = time;

                if (!string.IsNullOrEmpty(description.Text))
                {
                    ReadMoreOption.AddReadMoreTo(description, item.Description);
                    TextSanitizerAutoLink.Load(item.Description);
                }
                else
                {
                    description.Visibility = ViewStates.Gone;
                }

                if (item.Boosted == "1")
                {
                    FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, isBoostedIcon, IonIconsFonts.RibbonA);
                    isBoostedIcon.Text      += " " + ActivityContext.GetString(Resource.String.Lbl_Promoted);
                    isBoostedIcon.Visibility = ViewStates.Visible;
                }

                likeIcon.Tag = item.IsLiked ? "Like" : "Liked";
                ClickListeners.SetLike(likeIcon);

                favIcon.Tag = item.IsSaved ? "Add" : "Added";
                ClickListeners.SetFav(favIcon);

                commentCount.Text = item.Votes + " " + ActivityContext.GetString(Resource.String.Lbl_Comments);
                likeCount.Text    = item.Likes + " " + ActivityContext.GetString(Resource.String.Lbl_Likes);

                if (item.Votes > 0)
                {
                    viewMoreComments.Visibility = ViewStates.Visible;
                    viewMoreComments.Text       = ActivityContext.GetString(Resource.String.Lbl_ShowAllComments);
                }
                else
                {
                    viewMoreComments.Visibility = ViewStates.Gone;
                }

                if (!commentCount.HasOnClickListeners)
                {
                    commentCount.Click += (sender, e) => ClickListeners.OnCommentPostClick(new CommentFeedClickEventArgs {
                        View = itemView, NewsFeedClass = item
                    }, "NewsFeedPost");
                }

                if (!likeCount.HasOnClickListeners)
                {
                    likeCount.Click += (sender, e) => ClickListeners.OnLikedPostClick(new LikeNewsFeedClickEventArgs {
                        View = itemView, NewsFeedClass = item, LikeButton = likeCount
                    });
                }

                if (!likeIcon.HasOnClickListeners)
                {
                    likeIcon.Click += (sender, e) => ClickListeners.OnLikeNewsFeedClick(new LikeNewsFeedClickEventArgs {
                        View = itemView, NewsFeedClass = item, LikeButton = likeIcon
                    });
                }

                if (!favIcon.HasOnClickListeners)
                {
                    favIcon.Click += (sender, e) => ClickListeners.OnFavNewsFeedClick(new FavNewsFeedClickEventArgs {
                        NewsFeedClass = item, FavButton = favIcon
                    });
                }

                if (!userAvatar.HasOnClickListeners)
                {
                    userAvatar.Click += (sender, e) => ClickListeners.OnAvatarImageFeedClick(new AvatarFeedClickEventArgs {
                        NewsFeedClass = item, Image = userAvatar, View = itemView
                    }, "NewsFeedPost");
                }

                if (!commentIcon.HasOnClickListeners)
                {
                    commentIcon.Click += (sender, e) => ClickListeners.OnCommentClick(new CommentFeedClickEventArgs {
                        NewsFeedClass = item, View = itemView
                    }, "NewsFeedPost");
                }

                if (!viewMoreComments.HasOnClickListeners)
                {
                    viewMoreComments.Click += (sender, e) => ClickListeners.OnCommentClick(new CommentFeedClickEventArgs {
                        NewsFeedClass = item, View = itemView
                    }, "NewsFeedPost");
                }

                if (!moreIcon.HasOnClickListeners)
                {
                    moreIcon.Click += (sender, e) => ClickListeners.OnMoreClick(new MoreFeedClickEventArgs {
                        NewsFeedClass = item, View = itemView, IsOwner = item.IsOwner
                    }, true, "NewsFeedPost");
                }

                if (!shareIcon.HasOnClickListeners)
                {
                    shareIcon.Click += (sender, e) => ClickListeners.OnShareClick(new ShareFeedClickEventArgs {
                        NewsFeedClass = item, View = itemView
                    });
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Exemple #9
0
        public override void OnBindViewHolder(RecyclerView.ViewHolder viewHolder, int position)
        {
            try
            {
                if (position >= 0)
                {
                    int itemViewType = viewHolder.ItemViewType;

                    PostsObject item = PixelNewsFeedList[position];
                    if (item == null)
                    {
                        return;
                    }

                    item.Mp4 = Methods.FunString.StringNullRemover(item.Mp4);

                    switch (itemViewType)
                    {
                    case (int)NativeFeedType.Video:
                    {
                        if (viewHolder is Holders.VideoAdapterViewHolder holder)
                        {
                            if (item.MediaSet.Count > 0)
                            {
                                if (!string.IsNullOrEmpty(item.MediaSet[0]?.Extra))
                                {
                                    FullGlideRequestBuilder.Load(item.MediaSet[0]?.Extra).Into(holder.VideoImage);
                                }
                                else
                                {
                                    var fileName = item.MediaSet[0].File.Split('/').Last();
                                    var fileNameWithoutExtension = fileName.Split('.').First();

                                    item.MediaSet[0].Extra = Methods.Path.FolderDcimImage + "/" + fileNameWithoutExtension + ".png";

                                    var vidoePlaceHolderImage = Methods.MultiMedia.GetMediaFrom_Gallery(Methods.Path.FolderDcimImage, fileNameWithoutExtension + ".png");
                                    if (vidoePlaceHolderImage == "File Dont Exists")
                                    {
                                        var bitmapImage = Methods.MultiMedia.Retrieve_VideoFrame_AsBitmap(ActivityContext, item.MediaSet[0]?.File);
                                        if (bitmapImage != null)
                                        {
                                            Methods.MultiMedia.Export_Bitmap_As_Image(bitmapImage, fileNameWithoutExtension, Methods.Path.FolderDcimImage);
                                            FullGlideRequestBuilder.Load(bitmapImage).Into(holder.VideoImage);
                                        }
                                        else
                                        {
                                            Glide.With(ActivityContext)
                                            .AsBitmap()
                                            .Placeholder(Resource.Drawable.blackdefault)
                                            .Error(Resource.Drawable.blackdefault)
                                            .Load(item.MediaSet[0]?.File)         // or URI/path
                                            .Into(holder.VideoImage);             //image view to set thumbnail to
                                        }
                                    }
                                    else
                                    {
                                        FullGlideRequestBuilder.Load(vidoePlaceHolderImage).Into(holder.VideoImage);
                                    }
                                }

                                //GlideImageLoader.LoadImage(ActivityContext, imageUri,holder.VideoImage, ImageStyle.FitCenter, ImagePlaceholders.Color);
                            }

                            holder.MainView.Tag = holder;

                            if (AppSettings.SetTabDarkTheme)
                            {
                                holder.MainPost.SetBackgroundResource(Resource.Drawable.Shape_Radius_Black_Btn);
                            }

                            SetDataDynamicForViewHolder(holder.ItemView, holder.Username, holder.UserAvatar, holder.Description, holder.Likeicon, holder.Favicon, holder.CommentCount,
                                                        holder.LikeCount, holder.ViewMoreComment, holder.TimeText, holder.Commenticon, holder.Moreicon, holder.ShareIcon, holder.IsPromoted, item);

                            if (!holder.PlayControl.HasOnClickListeners)
                            {
                                holder.PlayControl.Click += (sender, args) =>
                                {
                                    try
                                    {
                                        PRecyclerView.GetInstance()?.PlayVideo(!PRecyclerView.GetInstance().CanScrollVertically(1), holder, item);
                                    }
                                    catch (Exception e)
                                    {
                                        Console.WriteLine(e);
                                    }
                                }
                            }
                            ;
                        }

                        break;
                    }

                    case (int)NativeFeedType.Youtube:
                    {
                        if (viewHolder is Holders.YoutubeAdapterViewHolder holder)
                        {
                            if (item.MediaSet.Count > 0)
                            {
                                if (string.IsNullOrEmpty(item.MediaSet[0]?.Extra))
                                {
                                    item.MediaSet[0].Extra = item.MediaSet[0]?.File;
                                }

                                FullGlideRequestBuilder.Load(item.MediaSet[0]?.Extra).Into(holder.VideoThumble);

                                //GlideImageLoader.LoadImage(ActivityContext, item.MediaSet[0]?.Extra, holder.VideoThumble, ImageStyle.FitCenter, ImagePlaceholders.Color);
                            }

                            if (AppSettings.SetTabDarkTheme)
                            {
                                holder.MainPost.SetBackgroundResource(Resource.Drawable.Shape_Radius_Black_Btn);
                            }

                            SetDataDynamicForViewHolder(holder.ItemView, holder.Username, holder.UserAvatar, holder.Description, holder.Likeicon, holder.Favicon, holder.CommentCount,
                                                        holder.LikeCount, holder.ViewMoreComment, holder.TimeText, holder.Commenticon, holder.Moreicon, holder.ShareIcon, holder.IsPromoted, item);


                            if (!holder.PlayButton.HasOnClickListeners)
                            {
                                holder.PlayButton.Click += (sender, args) =>
                                                           ClickListeners.OnPlayYoutubeButtonClicked(new YoutubeVideoClickEventArgs
                                    {
                                        Holder        = holder,
                                        NewsFeedClass = item,
                                        Position      = position,
                                        View          = holder.MainView
                                    });
                            }
                        }

                        break;
                    }

                    case (int)NativeFeedType.Photo:
                    {
                        if (viewHolder is Holders.PhotoAdapterViewHolder holder)
                        {
                            if (item.MediaSet.Count > 0)
                            {
                                if (string.IsNullOrEmpty(item.MediaSet[0]?.Extra))
                                {
                                    item.MediaSet[0].Extra = item.MediaSet[0]?.File;
                                }

                                FullGlideRequestBuilder.Load(item.MediaSet[0]?.File).Into(holder.Image);

                                //GlideImageLoader.LoadImage(ActivityContext, item.MediaSet[0]?.File, holder.Image, ImageStyle.FitCenter, ImagePlaceholders.Color);
                            }

                            if (AppSettings.SetTabDarkTheme)
                            {
                                holder.MainPost.SetBackgroundResource(Resource.Drawable.Shape_Radius_Black_Btn);
                            }

                            SetDataDynamicForViewHolder(holder.ItemView, holder.Username, holder.UserAvatar, holder.Description, holder.Likeicon, holder.Favicon, holder.CommentCount,
                                                        holder.LikeCount, holder.ViewMoreComment, holder.TimeText, holder.Commenticon, holder.Moreicon, holder.ShareIcon, holder.IsPromoted, item);
                        }

                        break;
                    }

                    case (int)NativeFeedType.Gif:
                    {
                        if (viewHolder is Holders.PhotoAdapterViewHolder holder)
                        {
                            if (AppSettings.SetTabDarkTheme)
                            {
                                holder.MainPost.SetBackgroundResource(Resource.Drawable.Shape_Radius_Black_Btn);
                            }

                            if (item.MediaSet.Count > 0)
                            {
                                if (string.IsNullOrEmpty(item.MediaSet[0]?.Extra))
                                {
                                    item.MediaSet[0].Extra = item.MediaSet[0]?.File;
                                }

                                FullGlideRequestBuilder.Load(item.MediaSet[0]?.File).Into(holder.Image);

                                //GlideImageLoader.LoadImage(ActivityContext, item.MediaSet[0]?.File,holder.Image, ImageStyle.FitCenter, ImagePlaceholders.Color);
                            }

                            SetDataDynamicForViewHolder(holder.ItemView, holder.Username, holder.UserAvatar, holder.Description, holder.Likeicon, holder.Favicon, holder.CommentCount,
                                                        holder.LikeCount, holder.ViewMoreComment, holder.TimeText, holder.Commenticon, holder.Moreicon, holder.ShareIcon, holder.IsPromoted, item);
                        }

                        break;
                    }

                    case (int)NativeFeedType.MultiPhoto:
                    {
                        if (viewHolder is Holders.MultiPhotoAdapterViewHolder holderMulti)
                        {
                            List <string> list = item.MediaSet.Select(image => image.File).ToList();

                            if (AppSettings.SetTabDarkTheme)
                            {
                                holderMulti.MainPost.SetBackgroundResource(Resource.Drawable.Shape_Radius_Black_Btn);
                            }

                            holderMulti.ViewPagerLayout.Adapter = new MultiImagePagerAdapter(ActivityContext, list);

                            holderMulti.ViewPagerLayout.CurrentItem = 0;
                            holderMulti.CircleIndicatorView.SetViewPager(holderMulti.ViewPagerLayout);

                            SetDataDynamicForViewHolder(holderMulti.ItemView, holderMulti.Username, holderMulti.UserAvatar, holderMulti.Description, holderMulti.Likeicon, holderMulti.Favicon, holderMulti.CommentCount, holderMulti.LikeCount,
                                                        holderMulti.ViewMoreComment, holderMulti.TimeText, holderMulti.Commenticon, holderMulti.Moreicon, holderMulti.ShareIcon, holderMulti.IsPromoted, item);
                        }

                        break;
                    }

                    case (int)NativeFeedType.Funding:
                    {
                        HolderFunding = viewHolder as Holders.FundingViewHolder;
                        BindFundingModel(HolderFunding, ListUtils.FundingList);
                        break;
                    }

                    case (int)NativeFeedType.AdMob:
                    {
                        Holders.AdMobAdapterViewHolder holder = viewHolder as Holders.AdMobAdapterViewHolder;
                        new Handler(Looper.MainLooper).Post(new Runnable(() =>
                            {
                                BindAdMob(holder);
                            })
                                                            );
                        break;
                    }

                    default:
                    {
                        if (viewHolder is Holders.PhotoAdapterViewHolder holder)
                        {
                            if (AppSettings.SetTabDarkTheme)
                            {
                                holder.MainPost.SetBackgroundResource(Resource.Drawable.Shape_Radius_Black_Btn);
                            }

                            if (item.MediaSet.Count > 0)
                            {
                                if (string.IsNullOrEmpty(item.MediaSet[0]?.Extra))
                                {
                                    item.MediaSet[0].Extra = item.MediaSet[0]?.File;
                                }

                                FullGlideRequestBuilder.Load(item.MediaSet[0]?.File).Into(holder.Image);
                                //GlideImageLoader.LoadImage(ActivityContext, item.MediaSet[0]?.File,holder.Image, ImageStyle.FitCenter, ImagePlaceholders.Color);
                            }

                            SetDataDynamicForViewHolder(holder.ItemView, holder.Username, holder.UserAvatar, holder.Description, holder.Likeicon, holder.Favicon, holder.CommentCount,
                                                        holder.LikeCount, holder.ViewMoreComment, holder.TimeText, holder.Commenticon, holder.Moreicon, holder.ShareIcon, holder.IsPromoted, item);
                        }

                        break;
                    }
                    }
                }
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
            }
        }