Ejemplo n.º 1
0
        public void OnClick(View v)
        {
            try
            {
                if (AdapterPosition != RecyclerView.NoPosition)
                {
                    CommentObjectExtra item = null !;
                    switch (TypeClass)
                    {
                    case "Comment":
                        item = CommentAdapter.CommentList[AdapterPosition];
                        break;

                    case "Post":
                        item = CommentAdapter.CommentList.FirstOrDefault(danjo => string.IsNullOrEmpty(danjo.CFile) && string.IsNullOrEmpty(danjo.Record));
                        break;

                    case "Reply":
                        item = ReplyCommentAdapter.ReplyCommentList[AdapterPosition];
                        break;
                    }

                    if (v.Id == Image.Id)
                    {
                        PostClickListener.ProfilePostClick(new ProfileClickEventArgs {
                            Holder = this, CommentClass = item, Position = AdapterPosition, View = MainView
                        });
                    }
                    else if (v.Id == LikeTextView.Id)
                    {
                        PostClickListener.LikeCommentReplyPostClick(new CommentReplyClickEventArgs {
                            Holder = this, CommentObject = item, Position = AdapterPosition, View = MainView
                        });
                    }
                    else if (v.Id == DislikeTextView.Id)
                    {
                        PostClickListener.DislikeCommentReplyPostClick(new CommentReplyClickEventArgs {
                            Holder = this, CommentObject = item, Position = AdapterPosition, View = MainView
                        });
                    }
                    else if (v.Id == ReplyTextView.Id)
                    {
                        PostClickListener.CommentReplyPostClick(new CommentReplyClickEventArgs {
                            Holder = this, CommentObject = item, Position = AdapterPosition, View = MainView
                        });
                    }
                    else if (v.Id == CommentImage?.Id)
                    {
                        PostClickListener.OpenImageLightBox(item);
                    }
                    else if (v.Id == PlayButton?.Id)
                    {
                        PostClickListener.PlaySound(new CommentReplyClickEventArgs {
                            Holder = this, CommentObject = item, Position = AdapterPosition, View = MainView
                        });
                    }
                    else if (v.Id == CountLikeSection?.Id)
                    {
                        PostClickListener.CountLikeCommentReplyPostClick(new CommentReplyClickEventArgs {
                            Holder = this, CommentObject = item, Position = AdapterPosition, View = MainView
                        });
                    }
                    else if (v.Id == RatingLinearLayout?.Id)
                    {
                        PostClickListener.RateCommentClickAsync(new CommentReplyClickEventArgs {
                            Holder = this, CommentObject = item, Position = AdapterPosition, View = MainView
                        });
                    }
                }
                else
                {
                    if (TypeClass == "Reply" && v.Id == RatingLinearLayout?.Id)
                    {
                        PostClickListener.RateCommentClickAsync(new CommentReplyClickEventArgs {
                            Holder = this, CommentObject = ReplyCommentObject, Position = AdapterPosition, View = MainView
                        });
                    }
                }
            }
            catch (Exception e)
            {
                Methods.DisplayReportResultTrack(e); Log.Debug("wael >> CommentAdapterViewHolder", e.Message + "\n" + e.StackTrace + "\n" + e.HelpLink);
            }
        }
        public void OnClick(View v)
        {
            try
            {
                if (AdapterPosition != RecyclerView.NoPosition)
                {
                    CommentObjectExtra item = TypeClass switch
                    {
                        "Comment" => CommentAdapter.CommentList[AdapterPosition],
                        "Post" => CommentAdapter.CommentList.FirstOrDefault(danjo =>
                                                                            string.IsNullOrEmpty(danjo.CFile) && string.IsNullOrEmpty(danjo.Record)),
                        "Reply" => ReplyCommentAdapter.ReplyCommentList[AdapterPosition],
                        _ => null !
                    };

                    if (v.Id == Image.Id)
                    {
                        PostClickListener.ProfilePostClick(new ProfileClickEventArgs {
                            Holder = this, CommentClass = item, Position = AdapterPosition, View = MainView
                        });
                    }
                    else if (v.Id == LikeTextView.Id)
                    {
                        PostClickListener.LikeCommentReplyPostClick(new CommentReplyClickEventArgs {
                            Holder = this, CommentObject = item, Position = AdapterPosition, View = MainView
                        });
                    }
                    else if (v.Id == DislikeTextView.Id)
                    {
                        PostClickListener.DislikeCommentReplyPostClick(new CommentReplyClickEventArgs {
                            Holder = this, CommentObject = item, Position = AdapterPosition, View = MainView
                        });
                    }
                    else if (v.Id == ReplyTextView.Id)
                    {
                        PostClickListener.CommentReplyPostClick(new CommentReplyClickEventArgs {
                            Holder = this, CommentObject = item, Position = AdapterPosition, View = MainView
                        });
                    }
                    else if (v.Id == CommentImage?.Id)
                    {
                        PostClickListener.OpenImageLightBox(item);
                    }
                    else if (v.Id == PlayButton?.Id)
                    {
                        PostClickListener.PlaySound(new CommentReplyClickEventArgs {
                            Holder = this, CommentObject = item, Position = AdapterPosition, View = MainView
                        });
                    }
                    else if (v.Id == CountLikeSection?.Id)
                    {
                        PostClickListener.CountLikeCommentReplyPostClick(new CommentReplyClickEventArgs {
                            Holder = this, CommentObject = item, Position = AdapterPosition, View = MainView
                        });
                    }
                }
            }
            catch (Exception e)
            {
                Methods.DisplayReportResultTrack(e);
            }
        }