private void InitComponent()
        {
            try
            {
                MainRecyclerView   = FindViewById <RecyclerView>(Resource.Id.recycler_view);
                CommentLayout      = FindViewById <ViewStub>(Resource.Id.comment_layout);
                ReplyCountTextView = FindViewById <TextView>(Resource.Id.replyCountTextview);

                TxtComment = FindViewById <EditText>(Resource.Id.commenttext);
                ImgBack    = FindViewById <ImageView>(Resource.Id.back);

                ImgSent    = FindViewById <ImageView>(Resource.Id.send);
                ImgGallery = FindViewById <ImageView>(Resource.Id.image);

                Methods.SetColorEditText(TxtComment, AppSettings.SetTabDarkTheme ? Color.White : Color.Black);

                if (AppSettings.FlowDirectionRightToLeft)
                {
                    ImgBack.SetImageResource(Resource.Drawable.ic_action_ic_back_rtl);
                }

                TxtComment.Text = "";
                PathImage       = "";

                ImgGallery.SetImageDrawable(AppSettings.SetTabDarkTheme ? GetDrawable(Resource.Drawable.ic_action_addpost_Ligth) : GetDrawable(Resource.Drawable.ic_action_AddPost));
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
        private void InitComponent()
        {
            try
            {
                RootView = FindViewById <LinearLayout>(Resource.Id.main_content);

                MRecycler = (RecyclerView)FindViewById(Resource.Id.recycler_view);

                SwipeRefreshLayout = (SwipeRefreshLayout)FindViewById(Resource.Id.swipeRefreshLayout);
                SwipeRefreshLayout.SetColorSchemeResources(Android.Resource.Color.HoloBlueLight, Android.Resource.Color.HoloGreenLight, Android.Resource.Color.HoloOrangeLight, Android.Resource.Color.HoloRedLight);
                SwipeRefreshLayout.Refreshing = true;
                SwipeRefreshLayout.Enabled    = true;
                SwipeRefreshLayout.SetProgressBackgroundColorSchemeColor(AppSettings.SetTabDarkTheme ? Color.ParseColor("#424242") : Color.ParseColor("#f7f7f7"));

                LikeCountBox  = FindViewById <TextView>(Resource.Id.like_box);
                EmojisView    = FindViewById <ImageView>(Resource.Id.emojiicon);
                TxtComment    = FindViewById <EmojiconEditText>(Resource.Id.commenttext);
                ImgSent       = FindViewById <ImageView>(Resource.Id.send);
                ImgGallery    = FindViewById <ImageView>(Resource.Id.image);
                ImgBack       = FindViewById <ImageView>(Resource.Id.back);
                CommentLayout = FindViewById <LinearLayout>(Resource.Id.commentLayout);

                BtnVoice = FindViewById <CircleButton>(Resource.Id.voiceButton);
                BtnVoice.LongClickable = true;
                BtnVoice.Tag           = "Free";
                BtnVoice.SetImageResource(Resource.Drawable.microphone);

                TopFragment = FindViewById <FrameLayout>(Resource.Id.TopFragmentHolder);

                TxtComment.Text = "";
                PathImage       = "";
                TextRecorder    = "";

                Methods.SetColorEditText(TxtComment, AppSettings.SetTabDarkTheme ? Color.White : Color.Black);

                RecordSoundFragment = new RecordSoundFragment();
                SupportFragmentManager.BeginTransaction().Add(TopFragment.Id, RecordSoundFragment, RecordSoundFragment.Tag);

                switch (AppSettings.FlowDirectionRightToLeft)
                {
                case true:
                    ImgBack.SetImageResource(Resource.Drawable.ic_action_ic_back_rtl);
                    break;
                }

                ImgGallery.SetImageDrawable(AppSettings.SetTabDarkTheme ? GetDrawable(Resource.Drawable.ic_action_addpost_Ligth) : GetDrawable(Resource.Drawable.ic_action_AddPost));

                var emojisIcon = new EmojIconActions(this, RootView, TxtComment, EmojisView);
                emojisIcon.ShowEmojIcon();
                emojisIcon.SetIconsIds(Resource.Drawable.ic_action_keyboard, Resource.Drawable.ic_action_sentiment_satisfied_alt);
            }
            catch (Exception e)
            {
                Methods.DisplayReportResultTrack(e);
            }
        }
        private void InitComponent()
        {
            try
            {
                LikeCountBox     = FindViewById <TextView>(Resource.Id.like_box);
                MainRecyclerView = FindViewById <RecyclerView>(Resource.Id.recycler_view);
                TxtComment       = FindViewById <EditText>(Resource.Id.commenttext);
                ImgSent          = FindViewById <ImageView>(Resource.Id.send);
                ImgGallery       = FindViewById <ImageView>(Resource.Id.image);
                ImgBack          = FindViewById <ImageView>(Resource.Id.back);
                CommentLayout    = FindViewById <LinearLayout>(Resource.Id.commentLayout);

                SwipeRefreshLayout = (SwipeRefreshLayout)FindViewById(Resource.Id.swipeRefreshLayout);
                SwipeRefreshLayout.SetColorSchemeResources(Android.Resource.Color.HoloBlueLight, Android.Resource.Color.HoloGreenLight, Android.Resource.Color.HoloOrangeLight, Android.Resource.Color.HoloRedLight);
                SwipeRefreshLayout.Refreshing = true;
                SwipeRefreshLayout.Enabled    = true;
                SwipeRefreshLayout.SetProgressBackgroundColorSchemeColor(AppSettings.SetTabDarkTheme ? Color.ParseColor("#424242") : Color.ParseColor("#f7f7f7"));

                BtnVoice = FindViewById <CircleButton>(Resource.Id.voiceButton);
                BtnVoice.LongClickable = true;
                BtnVoice.Tag           = "Free";
                BtnVoice.SetImageResource(Resource.Drawable.microphone);

                TopFragment = FindViewById <FrameLayout>(Resource.Id.TopFragmentHolder);

                TxtComment.Text = "";
                PathImage       = "";
                TextRecorder    = "";

                RecordSoundFragment = new RecordSoundFragment();
                SupportFragmentManager.BeginTransaction().Add(TopFragment.Id, RecordSoundFragment, RecordSoundFragment.Tag);

                CommentsAdapter = new CommentAdapter(this, MainRecyclerView, "Light", PostId)
                {
                    CommentList = new ObservableCollection <CommentObjectExtra>()
                };

                if (AppSettings.FlowDirectionRightToLeft)
                {
                    ImgBack.SetImageResource(Resource.Drawable.ic_action_ic_back_rtl);
                }

                ImgGallery.SetImageDrawable(AppSettings.SetTabDarkTheme ? GetDrawable(Resource.Drawable.ic_action_addpost_Ligth) : GetDrawable(Resource.Drawable.ic_action_AddPost));
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Exemplo n.º 4
0
        private void InitComponent()
        {
            try
            {
                RootView = FindViewById <LinearLayout>(Resource.Id.main_content);

                MRecycler = (RecyclerView)FindViewById(Resource.Id.recycler_view);

                EmojisView    = FindViewById <ImageView>(Resource.Id.emojiicon);
                TxtComment    = FindViewById <EmojiconEditText>(Resource.Id.commenttext);
                ImgSent       = FindViewById <ImageView>(Resource.Id.send);
                ImgGallery    = FindViewById <ImageView>(Resource.Id.image);
                ImgBack       = FindViewById <ImageView>(Resource.Id.back);
                CommentLayout = FindViewById <ViewStub>(Resource.Id.comment_layout);

                ReplyCountTextView = FindViewById <TextView>(Resource.Id.replyCountTextview);

                switch (AppSettings.FlowDirectionRightToLeft)
                {
                case true:
                    ImgBack.SetImageResource(Resource.Drawable.ic_action_ic_back_rtl);
                    break;
                }

                ImgGallery.SetImageDrawable(AppSettings.SetTabDarkTheme ? GetDrawable(Resource.Drawable.ic_action_addpost_Ligth) : GetDrawable(Resource.Drawable.ic_action_AddPost));

                var repliesCount = !string.IsNullOrEmpty(CommentObject.RepliesCount) ? CommentObject.RepliesCount : CommentObject.Replies ?? "";
                ReplyCountTextView.Text = repliesCount + " " + GetString(Resource.String.Lbl_Replies);

                Methods.SetColorEditText(TxtComment, AppSettings.SetTabDarkTheme ? Color.White : Color.Black);

                TxtComment.Text = "@" + CommentObject?.Publisher?.Username + " " ?? "";
                PathImage       = "";

                var emojisIcon = new EmojIconActions(this, RootView, TxtComment, EmojisView);
                emojisIcon.ShowEmojIcon();
                emojisIcon.SetIconsIds(Resource.Drawable.ic_action_keyboard, Resource.Drawable.ic_action_sentiment_satisfied_alt);
            }
            catch (Exception e)
            {
                Methods.DisplayReportResultTrack(e);
            }
        }
Exemplo n.º 5
0
        //Api sent Comment
        private async void ImgSentOnClick(object sender, EventArgs e)
        {
            try
            {
                IsRecording = false;

                if (BtnVoice.Tag?.ToString() == "Audio")
                {
                    var interTortola = new FastOutSlowInInterpolator();
                    TopFragment.Animate().SetInterpolator(interTortola).TranslationY(1200).SetDuration(300);
                    SupportFragmentManager.BeginTransaction().Remove(RecordSoundFragment).Commit();

                    PathVoice = RecorderService.GetRecorded_Sound_Path();
                }

                if (string.IsNullOrEmpty(TxtComment.Text) && string.IsNullOrEmpty(PathImage) && string.IsNullOrEmpty(PathVoice))
                {
                    return;
                }

                if (Methods.CheckConnectivity())
                {
                    var dataUser = ListUtils.MyProfileList.FirstOrDefault();
                    //Comment Code

                    var    unixTimestamp = DateTimeOffset.UtcNow.ToUnixTimeSeconds();
                    string time2         = unixTimestamp.ToString(CultureInfo.InvariantCulture);

                    CommentObjectExtra comment = new CommentObjectExtra
                    {
                        Id             = unixTimestamp.ToString(),
                        PostId         = PostObject.Id,
                        UserId         = UserDetails.UserId,
                        Text           = TxtComment.Text,
                        Time           = time2,
                        CFile          = PathImage,
                        Record         = PathVoice,
                        Publisher      = dataUser,
                        Url            = dataUser?.Url,
                        Fullurl        = PostObject?.PostUrl,
                        Orginaltext    = TxtComment.Text,
                        Owner          = true,
                        CommentLikes   = "0",
                        CommentWonders = "0",
                        IsCommentLiked = false,
                        Replies        = "0"
                    };

                    MAdapter.CommentList.Add(comment);

                    var index = MAdapter.CommentList.IndexOf(comment);
                    if (index > -1)
                    {
                        MAdapter.NotifyItemInserted(index);
                    }

                    MRecycler.Visibility = ViewStates.Visible;

                    var dd = MAdapter.CommentList.FirstOrDefault();
                    if (dd?.Text == MAdapter.EmptyState)
                    {
                        MAdapter.CommentList.Remove(dd);
                        MAdapter.NotifyItemRemoved(MAdapter.CommentList.IndexOf(dd));
                    }

                    ImgGallery.SetImageDrawable(AppSettings.SetTabDarkTheme ? GetDrawable(Resource.Drawable.ic_action_addpost_Ligth) : GetDrawable(Resource.Drawable.ic_action_AddPost));
                    var text = TxtComment.Text;

                    //Hide keyboard
                    TxtComment.Text = "";

                    (int apiStatus, var respond) = await RequestsAsync.Comment.CreatePostComments(PostObject.PostId, text, PathImage, PathVoice);

                    if (apiStatus == 200)
                    {
                        if (respond is CreateComments result)
                        {
                            var date = MAdapter.CommentList.FirstOrDefault(a => a.Id == comment.Id) ?? MAdapter.CommentList.FirstOrDefault(x => x.Id == result.Data.Id);
                            if (date != null)
                            {
                                var db = Mapper.Map <CommentObjectExtra>(result.Data);

                                date    = db;
                                date.Id = result.Data.Id;

                                index = MAdapter.CommentList.IndexOf(MAdapter.CommentList.FirstOrDefault(a => a.Id == unixTimestamp.ToString()));
                                if (index > -1)
                                {
                                    MAdapter.CommentList[index] = db;

                                    //MAdapter.NotifyItemChanged(index);
                                    //MRecycler.ScrollToPosition(index);
                                }

                                var postFeedAdapter = TabbedMainActivity.GetInstance()?.NewsFeedTab?.PostFeedAdapter;
                                var dataGlobal      = postFeedAdapter?.ListDiffer?.Where(a => a.PostData?.Id == PostObject?.PostId).ToList();
                                if (dataGlobal?.Count > 0)
                                {
                                    foreach (var dataClass in from dataClass in dataGlobal let indexCom = postFeedAdapter.ListDiffer.IndexOf(dataClass) where indexCom > -1 select dataClass)
                                    {
                                        dataClass.PostData.PostComments = MAdapter.CommentList.Count.ToString();

                                        if (dataClass.PostData.GetPostComments?.Count > 0)
                                        {
                                            var dataComment = dataClass.PostData.GetPostComments.FirstOrDefault(a => a.Id == date.Id);
                                            if (dataComment == null)
                                            {
                                                dataClass.PostData.GetPostComments.Add(date);
                                            }
                                        }
                                        else
                                        {
                                            dataClass.PostData.GetPostComments = new List <GetCommentObject>()
                                            {
                                                date
                                            };
                                        }

                                        postFeedAdapter.NotifyItemChanged(postFeedAdapter.ListDiffer.IndexOf(dataClass), "commentReplies");
                                    }
                                }

                                var postFeedAdapter2 = WRecyclerView.GetInstance()?.NativeFeedAdapter;
                                var dataGlobal2      = postFeedAdapter2?.ListDiffer?.Where(a => a.PostData?.Id == PostObject?.PostId).ToList();
                                if (dataGlobal2?.Count > 0)
                                {
                                    foreach (var dataClass in from dataClass in dataGlobal2 let indexCom = postFeedAdapter2.ListDiffer.IndexOf(dataClass) where indexCom > -1 select dataClass)
                                    {
                                        dataClass.PostData.PostComments = MAdapter.CommentList.Count.ToString();

                                        if (dataClass.PostData.GetPostComments?.Count > 0)
                                        {
                                            var dataComment = dataClass.PostData.GetPostComments.FirstOrDefault(a => a.Id == date.Id);
                                            if (dataComment == null)
                                            {
                                                dataClass.PostData.GetPostComments.Add(date);
                                            }
                                        }
                                        else
                                        {
                                            dataClass.PostData.GetPostComments = new List <GetCommentObject>()
                                            {
                                                date
                                            };
                                        }

                                        postFeedAdapter2.NotifyItemChanged(postFeedAdapter2.ListDiffer.IndexOf(dataClass), "commentReplies");
                                    }
                                }
                            }
                        }
                    }
                    //else Methods.DisplayReportResult(this, respond);

                    //Hide keyboard
                    TxtComment.Text = "";
                    PathImage       = "";
                    PathVoice       = "";

                    BtnVoice.Tag = "Free";
                    BtnVoice.SetImageResource(Resource.Drawable.microphone);
                    BtnVoice.ClearColorFilter();
                }
                else
                {
                    Toast.MakeText(this, GetText(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short).Show();
                }
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
            }
        }
        //Api sent Comment
        private async void ImgSentOnClick(object sender, EventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(TxtComment.Text) && string.IsNullOrEmpty(PathImage))
                {
                    return;
                }

                if (Methods.CheckConnectivity())
                {
                    CommentObject.Replies ??= "0";

                    //Comment Code
                    var dataUser = ListUtils.MyProfileList.FirstOrDefault();

                    var unixTimestamp = DateTimeOffset.UtcNow.ToUnixTimeSeconds();

                    CommentObjectExtra comment = new CommentObjectExtra
                    {
                        Id             = unixTimestamp.ToString(),
                        PostId         = CommentObject.PostId,
                        UserId         = UserDetails.UserId,
                        Text           = TxtComment.Text,
                        Time           = unixTimestamp.ToString(),
                        CFile          = PathImage,
                        Record         = "",
                        Publisher      = dataUser,
                        Url            = dataUser?.Url,
                        Fullurl        = CommentObject?.Fullurl,
                        Orginaltext    = TxtComment.Text,
                        Owner          = true,
                        CommentLikes   = "0",
                        CommentWonders = "0",
                        IsCommentLiked = false,
                        Replies        = "0"
                    };

                    MAdapter.ReplyCommentList.Add(comment);

                    var index = MAdapter.ReplyCommentList.IndexOf(comment);
                    if (index > -1)
                    {
                        MAdapter.NotifyItemInserted(index);
                    }

                    MainRecyclerView.Visibility = ViewStates.Visible;

                    var dd = MAdapter.ReplyCommentList.FirstOrDefault();
                    if (dd?.Text == MAdapter.EmptyState)
                    {
                        MAdapter.ReplyCommentList.Remove(dd);
                        MAdapter.NotifyItemRemoved(MAdapter.ReplyCommentList.IndexOf(dd));
                    }

                    //CommentLayout.Visibility = ViewStates.Gone;
                    bool success = int.TryParse(CommentObject.Replies, out var number);
                    if (success)
                    {
                        Console.WriteLine("Converted '{0}' to {1}.", CommentObject.Replies, number);
                        var x = number + 1;
                        ReplyCountTextView.Text = x + " " + GetString(Resource.String.Lbl_Replies);
                    }
                    else
                    {
                        Console.WriteLine("Attempted conversion of '{0}' failed.", CommentObject.Replies ?? "<null>");
                        ReplyCountTextView.Text = 1 + " " + GetString(Resource.String.Lbl_Replies);
                    }

                    ImgGallery.SetImageDrawable(AppSettings.SetTabDarkTheme ? GetDrawable(Resource.Drawable.ic_action_addpost_Ligth) : GetDrawable(Resource.Drawable.ic_action_AddPost));

                    var text = TxtComment.Text;

                    //Hide keyboard
                    TxtComment.Text = "";

                    (int apiStatus, var respond) = await RequestsAsync.Comment.CreatePostComments(CommentId, text, PathImage, "", "create_reply");

                    if (apiStatus == 200)
                    {
                        if (respond is CreateComments result)
                        {
                            var date = MAdapter.ReplyCommentList.FirstOrDefault(a => a.Id == comment.Id) ?? MAdapter.ReplyCommentList.FirstOrDefault(x => x.Id == result.Data.Id);
                            if (date != null)
                            {
                                var db = Mapper.Map <CommentObjectExtra>(result.Data);

                                date    = db;
                                date.Id = result.Data.Id;

                                index = MAdapter.ReplyCommentList.IndexOf(MAdapter.ReplyCommentList.FirstOrDefault(a => a.Id == unixTimestamp.ToString()));
                                if (index > -1)
                                {
                                    MAdapter.ReplyCommentList[index] = db;

                                    //MAdapter.NotifyItemChanged(index, !string.IsNullOrEmpty(PathImage) ? 1 : 0);
                                    //MainRecyclerView.ScrollToPosition(index);
                                }

                                var postFeedAdapter = WRecyclerView.GetInstance()?.NativeFeedAdapter;
                                var dataGlobal      = postFeedAdapter?.ListDiffer?.Where(a => a.PostData?.Id == CommentObject?.PostId).ToList();
                                if (dataGlobal?.Count > 0)
                                {
                                    foreach (var dataClass in from dataClass in dataGlobal let indexCom = postFeedAdapter.ListDiffer.IndexOf(dataClass) where indexCom > -1 select dataClass)
                                    {
                                        if (dataClass.PostData.GetPostComments?.Count > 0)
                                        {
                                            var dataComment = dataClass.PostData.GetPostComments.FirstOrDefault(a => a.Id == date.Id);
                                            if (dataComment != null)
                                            {
                                                dataComment.Replies = MAdapter.ReplyCommentList.Count.ToString();
                                            }
                                        }

                                        postFeedAdapter.NotifyItemChanged(postFeedAdapter.ListDiffer.IndexOf(dataClass));
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        Methods.DisplayReportResult(this, respond);
                    }

                    //Hide keyboard
                    TxtComment.Text = "";
                    PathImage       = "";
                }
                else
                {
                    Toast.MakeText(this, GetText(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short).Show();
                }
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
            }
        }
Exemplo n.º 7
0
        //Api sent Comment
        private async void ImgSentOnClick(object sender, EventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(TxtComment.Text) && string.IsNullOrWhiteSpace(TxtComment.Text) && string.IsNullOrEmpty(PathImage))
                {
                    return;
                }

                if (Methods.CheckConnectivity())
                {
                    CommentObject.Replies ??= "0";
                    CommentObject.RepliesCount ??= "0";

                    //Comment Code
                    var dataUser = ListUtils.MyProfileList?.FirstOrDefault();

                    var unixTimestamp = DateTimeOffset.UtcNow.ToUnixTimeSeconds();

                    CommentObjectExtra comment = new CommentObjectExtra
                    {
                        Id             = unixTimestamp.ToString(),
                        PostId         = CommentObject.PostId,
                        UserId         = UserDetails.UserId,
                        Text           = TxtComment.Text,
                        Time           = unixTimestamp.ToString(),
                        CFile          = PathImage,
                        Record         = "",
                        Publisher      = dataUser,
                        Url            = dataUser?.Url,
                        Fullurl        = CommentObject?.Fullurl,
                        Orginaltext    = TxtComment.Text,
                        Owner          = true,
                        CommentLikes   = "0",
                        CommentWonders = "0",
                        IsCommentLiked = false,
                        Replies        = "0",
                        RepliesCount   = "0",
                    };

                    MAdapter.ReplyCommentList.Add(comment);

                    var index = MAdapter.ReplyCommentList.IndexOf(comment);
                    switch (index)
                    {
                    case > -1:
                        MAdapter.NotifyItemInserted(index);
                        break;
                    }

                    MRecycler.Visibility = ViewStates.Visible;

                    var dd = MAdapter.ReplyCommentList.FirstOrDefault();
                    if (dd?.Text == MAdapter.EmptyState)
                    {
                        MAdapter.ReplyCommentList.Remove(dd);
                        MAdapter.NotifyItemRemoved(MAdapter.ReplyCommentList.IndexOf(dd));
                    }

                    var repliesCount = !string.IsNullOrEmpty(CommentObject.RepliesCount) ? CommentObject.RepliesCount : CommentObject.Replies ?? "";

                    //CommentLayout.Visibility = ViewStates.Gone;
                    bool success = int.TryParse(repliesCount, out var number);
                    switch (success)
                    {
                    case true:
                    {
                        Console.WriteLine("Converted '{0}' to {1}.", repliesCount, number);
                        var x = number + 1;
                        ReplyCountTextView.Text = x + " " + GetString(Resource.String.Lbl_Replies);
                        break;
                    }

                    default:
                        Console.WriteLine("Attempted conversion of '{0}' failed.", repliesCount ?? "<null>");
                        ReplyCountTextView.Text = 1 + " " + GetString(Resource.String.Lbl_Replies);
                        break;
                    }

                    ImgGallery.SetImageDrawable(AppSettings.SetTabDarkTheme ? GetDrawable(Resource.Drawable.ic_action_addpost_Ligth) : GetDrawable(Resource.Drawable.ic_action_AddPost));

                    var text = TxtComment.Text;

                    //Hide keyboard
                    TxtComment.Text = "";

                    var(apiStatus, respond) = await RequestsAsync.Comment.CreatePostCommentsAsync(CommentId, text, PathImage, "", "create_reply");

                    switch (apiStatus)
                    {
                    case 200:
                    {
                        switch (respond)
                        {
                        case CreateComments result:
                        {
                            var date = MAdapter.ReplyCommentList.FirstOrDefault(a => a.Id == comment.Id) ?? MAdapter.ReplyCommentList.FirstOrDefault(x => x.Id == result.Data.Id);
                            if (date != null)
                            {
                                var db = ClassMapper.Mapper?.Map <CommentObjectExtra>(result.Data);

                                date    = db;
                                date.Id = result.Data.Id;

                                index = MAdapter.ReplyCommentList.IndexOf(MAdapter.ReplyCommentList.FirstOrDefault(a => a.Id == unixTimestamp.ToString()));
                                MAdapter.ReplyCommentList[index] = index switch
                                {
                                    > -1 => db,
                                    _ => MAdapter.ReplyCommentList[index]
                                };

                                var commentAdapter = CommentActivity.GetInstance()?.MAdapter;
                                var commentObject  = commentAdapter?.CommentList?.FirstOrDefault(a => a.Id == CommentId);
                                if (commentObject != null)
                                {
                                    commentObject.Replies      = commentAdapter.CommentList.Count.ToString();
                                    commentObject.RepliesCount = commentAdapter.CommentList.Count.ToString();
                                    commentAdapter.NotifyDataSetChanged();
                                }

                                var postFeedAdapter = TabbedMainActivity.GetInstance()?.NewsFeedTab?.PostFeedAdapter;
                                var dataGlobal      = postFeedAdapter?.ListDiffer?.Where(a => a.PostData?.Id == CommentObject?.PostId).ToList();
                                switch (dataGlobal?.Count)
                                {
                                case > 0:
                                {
                                    foreach (var dataClass in from dataClass in dataGlobal let indexCom = postFeedAdapter.ListDiffer.IndexOf(dataClass) where indexCom > -1 select dataClass)
                                    {
                                        switch (dataClass.PostData.GetPostComments?.Count)
                                        {
                                        case > 0:
                                        {
                                            var dataComment = dataClass.PostData.GetPostComments.FirstOrDefault(a => a.Id == date.Id);
                                            if (dataComment != null)
                                            {
                                                dataComment.Replies      = MAdapter.ReplyCommentList.Count.ToString();
                                                dataComment.RepliesCount = MAdapter.ReplyCommentList.Count.ToString();
                                            }

                                            break;
                                        }
                                        }

                                        postFeedAdapter.NotifyItemChanged(postFeedAdapter.ListDiffer.IndexOf(dataClass), "commentReplies");
                                    }

                                    break;
                                }
                                }

                                var postFeedAdapter2 = WRecyclerView.GetInstance()?.NativeFeedAdapter;
                                var dataGlobal1      = postFeedAdapter2?.ListDiffer?.Where(a => a.PostData?.Id == CommentObject?.PostId).ToList();
                                switch (dataGlobal1?.Count)
                                {
                                case > 0:
                                {
                                    foreach (var dataClass in from dataClass in dataGlobal1 let indexCom = postFeedAdapter2.ListDiffer.IndexOf(dataClass) where indexCom > -1 select dataClass)
                                    {
                                        switch (dataClass.PostData.GetPostComments?.Count)
                                        {
                                        case > 0:
                                        {
                                            var dataComment = dataClass.PostData.GetPostComments.FirstOrDefault(a => a.Id == date.Id);
                                            if (dataComment != null)
                                            {
                                                dataComment.Replies      = MAdapter.ReplyCommentList.Count.ToString();
                                                dataComment.RepliesCount = MAdapter.ReplyCommentList.Count.ToString();
                                            }

                                            break;
                                        }
                                        }

                                        postFeedAdapter2.NotifyItemChanged(postFeedAdapter2.ListDiffer.IndexOf(dataClass), "commentReplies");
                                    }

                                    break;
                                }
                                }
                            }

                            break;
                        }
                        }

                        break;
                    }
                    }
        //Api sent Comment
        private async void ImgSentOnClick(object sender, EventArgs e)
        {
            try
            {
                IsRecording = false;

                switch (BtnVoice.Tag?.ToString())
                {
                case "Audio":
                {
                    var interTortola = new FastOutSlowInInterpolator();
                    TopFragment.Animate()?.SetInterpolator(interTortola)?.TranslationY(1200)?.SetDuration(300);
                    SupportFragmentManager.BeginTransaction().Remove(RecordSoundFragment)?.Commit();

                    PathVoice = RecorderService.GetRecorded_Sound_Path();
                    break;
                }
                }

                if (string.IsNullOrEmpty(TxtComment.Text) && string.IsNullOrWhiteSpace(TxtComment.Text) && string.IsNullOrEmpty(PathImage) && string.IsNullOrEmpty(PathVoice))
                {
                    return;
                }

                if (Methods.CheckConnectivity())
                {
                    var dataUser = ListUtils.MyProfileList?.FirstOrDefault();
                    //Comment Code

                    var    unixTimestamp = DateTimeOffset.UtcNow.ToUnixTimeSeconds();
                    string time2         = unixTimestamp.ToString(CultureInfo.InvariantCulture);

                    CommentObjectExtra comment = new CommentObjectExtra
                    {
                        Id             = unixTimestamp.ToString(),
                        PostId         = PostObject.Id,
                        UserId         = UserDetails.UserId,
                        Text           = TxtComment.Text,
                        Time           = time2,
                        CFile          = PathImage,
                        Record         = PathVoice,
                        Publisher      = dataUser,
                        Url            = dataUser?.Url,
                        Fullurl        = PostObject?.PostUrl,
                        Orginaltext    = TxtComment.Text,
                        Owner          = true,
                        CommentLikes   = "0",
                        CommentWonders = "0",
                        IsCommentLiked = false,
                        Replies        = "0",
                        RepliesCount   = "0"
                    };

                    MAdapter.CommentList.Add(comment);

                    var index = MAdapter.CommentList.IndexOf(comment);
                    switch (index)
                    {
                    case > -1:
                        MAdapter.NotifyItemInserted(index);
                        break;
                    }

                    MRecycler.Visibility = ViewStates.Visible;

                    var dd = MAdapter.CommentList.FirstOrDefault();
                    if (dd?.Text == MAdapter.EmptyState)
                    {
                        MAdapter.CommentList.Remove(dd);
                        MAdapter.NotifyItemRemoved(MAdapter.CommentList.IndexOf(dd));
                    }

                    ImgGallery.SetImageDrawable(AppSettings.SetTabDarkTheme ? GetDrawable(Resource.Drawable.ic_action_addpost_Ligth) : GetDrawable(Resource.Drawable.ic_action_AddPost));
                    var text = TxtComment.Text;

                    //Hide keyboard
                    TxtComment.Text = "";

                    var(apiStatus, respond) = await RequestsAsync.Comment.CreatePostCommentsAsync(PostObject.PostId, text, PathImage, PathVoice);

                    switch (apiStatus)
                    {
                    case 200:
                    {
                        switch (respond)
                        {
                        case CreateComments result:
                        {
                            var date = MAdapter.CommentList.FirstOrDefault(a => a.Id == comment.Id) ?? MAdapter.CommentList.FirstOrDefault(x => x.Id == result.Data.Id);
                            if (date != null)
                            {
                                var db = ClassMapper.Mapper?.Map <CommentObjectExtra>(result.Data);

                                date    = db;
                                date.Id = result.Data.Id;

                                index = MAdapter.CommentList.IndexOf(MAdapter.CommentList.FirstOrDefault(a => a.Id == unixTimestamp.ToString()));
                                MAdapter.CommentList[index] = index switch
                                {
                                    > -1 => db,
                                    _ => MAdapter.CommentList[index]
                                };

                                var postFeedAdapter = TabbedMainActivity.GetInstance()?.NewsFeedTab?.PostFeedAdapter;
                                var dataGlobal      = postFeedAdapter?.ListDiffer?.Where(a => a.PostData?.Id == PostObject?.PostId).ToList();
                                switch (dataGlobal?.Count)
                                {
                                case > 0:
                                {
                                    foreach (var dataClass in from dataClass in dataGlobal let indexCom = postFeedAdapter.ListDiffer.IndexOf(dataClass) where indexCom > -1 select dataClass)
                                    {
                                        dataClass.PostData.PostComments = MAdapter.CommentList.Count.ToString();

                                        switch (dataClass.PostData.GetPostComments?.Count)
                                        {
                                        case > 0:
                                        {
                                            var dataComment = dataClass.PostData.GetPostComments.FirstOrDefault(a => a.Id == date.Id);
                                            switch (dataComment)
                                            {
                                            case null:
                                                dataClass.PostData.GetPostComments.Add(date);
                                                break;
                                            }

                                            break;
                                        }

                                        default:
                                            dataClass.PostData.GetPostComments = new List <GetCommentObject> {
                                                date
                                            };
                                            break;
                                        }

                                        postFeedAdapter.NotifyItemChanged(postFeedAdapter.ListDiffer.IndexOf(dataClass), "commentReplies");
                                    }

                                    break;
                                }
                                }

                                var postFeedAdapter2 = WRecyclerView.GetInstance()?.NativeFeedAdapter;
                                var dataGlobal2      = postFeedAdapter2?.ListDiffer?.Where(a => a.PostData?.Id == PostObject?.PostId).ToList();
                                switch (dataGlobal2?.Count)
                                {
                                case > 0:
                                {
                                    foreach (var dataClass in from dataClass in dataGlobal2 let indexCom = postFeedAdapter2.ListDiffer.IndexOf(dataClass) where indexCom > -1 select dataClass)
                                    {
                                        dataClass.PostData.PostComments = MAdapter.CommentList.Count.ToString();

                                        switch (dataClass.PostData.GetPostComments?.Count)
                                        {
                                        case > 0:
                                        {
                                            var dataComment = dataClass.PostData.GetPostComments.FirstOrDefault(a => a.Id == date.Id);
                                            switch (dataComment)
                                            {
                                            case null:
                                                dataClass.PostData.GetPostComments.Add(date);
                                                break;
                                            }

                                            break;
                                        }

                                        default:
                                            dataClass.PostData.GetPostComments = new List <GetCommentObject> {
                                                date
                                            };
                                            break;
                                        }

                                        postFeedAdapter2.NotifyItemChanged(postFeedAdapter2.ListDiffer.IndexOf(dataClass), "commentReplies");
                                    }

                                    break;
                                }
                                }
                            }

                            break;
                        }
                        }

                        break;
                    }
                    }