示例#1
0
        private async void LikeCommentClick(UIFeedButton button)
        {
            button.LoadingIndicatorButton(true);

            if ("Like".Equals(button.CurrentTitle))
            {
                button.SetTitle("Unlike", UIControlState.Normal);

                updateLikeCount(++surveyCommentModel.totalLikes);

                SurveyCommentLikeModel surveyCommentLikeModel = new SurveyCommentLikeModel();
                surveyCommentLikeModel.commentId = surveyCommentModel.surveyId + surveyCommentModel.commentDate;
                surveyCommentLikeModel.user      = new User();
                surveyCommentLikeModel.user.id   = LoginController.userModel.id;

                surveyCommentModel.userLiked = true;

                await commentLikeManager.LikeComment(surveyCommentLikeModel, LoginController.tokenModel.access_token);
            }
            else
            {
                button.SetTitle("Like", UIControlState.Normal);
                updateLikeCount(--surveyCommentModel.totalLikes);

                surveyCommentModel.userLiked = null;

                await commentLikeManager.UnlikeComment(surveyCommentModel.surveyId + surveyCommentModel.commentDate, LoginController.userModel.id, LoginController.tokenModel.access_token);
            }

            LayoutSubviews();

            button.LoadingIndicatorButton(false);
        }
 private void GroupProfileBtn(UIFeedButton button)
 {
     Utils.OpenGroupProfile(this.NavigationController, groupId);
 }
示例#3
0
        public CommentCell(CGRect frame) : base(frame)
        {
            imageView = new UIImageView();
            imageView.Layer.CornerRadius     = 22;
            imageView.ContentMode            = UIViewContentMode.ScaleAspectFill;
            imageView.Layer.MasksToBounds    = true;
            imageView.UserInteractionEnabled = true;
            imageView.TranslatesAutoresizingMaskIntoConstraints = false;

            commentText = new UITextView();
            commentText.BackgroundColor = UIColor.White;
            commentText.TextColor       = UIColor.FromRGB(90, 89, 89);
            commentText.Selectable      = false;
            commentText.Font            = UIFont.SystemFontOfSize(14);
            commentText.TranslatesAutoresizingMaskIntoConstraints = false;
            commentText.Editable      = false;
            commentText.ScrollEnabled = false;

            likeButton = new UIFeedButton();
            likeButton.SetTitle("Like", UIControlState.Normal);
            likeButton.AddTarget(Self, new ObjCRuntime.Selector("LikeCommentClick:"), UIControlEvent.TouchUpInside);

            nameLabel           = new UILabel();
            nameLabel.TextColor = UIColor.FromRGB(90, 89, 89);
            nameLabel.Font      = UIFont.BoldSystemFontOfSize(14);

            dateLabel           = new UILabel();
            dateLabel.TextColor = UIColor.FromRGB(90, 89, 89);
            dateLabel.Font      = UIFont.SystemFontOfSize(12);

            lineSeparator = new UIView();
            lineSeparator.BackgroundColor = UIColor.FromRGBA(nfloat.Parse("0.88"), nfloat.Parse("0.89"), nfloat.Parse("0.90"), nfloat.Parse("1"));

            ContentView.Add(imageView);
            ContentView.Add(likeButton);
            ContentView.Add(nameLabel);
            ContentView.Add(commentText);
            ContentView.Add(dateLabel);
            ContentView.Add(lineSeparator);

            ContentView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();
            ContentView.AddConstraints(
                imageView.AtLeftOf(ContentView, 8),
                imageView.Width().EqualTo(40),
                imageView.Height().EqualTo(40),
                imageView.AtTopOf(ContentView, 8),

                likeButton.AtRightOf(ContentView, 8),
                likeButton.Width().EqualTo(60),
                likeButton.Height().EqualTo(24),
                likeButton.AtTopOf(ContentView, 4),

                nameLabel.Right().EqualTo().LeftOf(likeButton).Plus(8),
                nameLabel.AtTopOf(ContentView, 8),
                nameLabel.Left().EqualTo().RightOf(imageView).Plus(8),
                nameLabel.Height().EqualTo(20),

                commentText.AtTopOf(ContentView, 28),
                commentText.AtRightOf(ContentView, 8),
                commentText.Left().EqualTo().RightOf(imageView).Plus(3),
                commentText.AtBottomOf(ContentView, 30),

                dateLabel.Below(commentText, 5),
                dateLabel.Height().EqualTo(20),
                dateLabel.AtRightOf(ContentView, 8),
                dateLabel.AtLeftOf(ContentView, 56),
                dateLabel.AtBottomOf(ContentView, 5),

                lineSeparator.AtBottomOf(ContentView, 1),
                lineSeparator.AtRightOf(ContentView, 8),
                lineSeparator.AtLeftOf(ContentView, 8),
                lineSeparator.Height().EqualTo(1)

                );
        }
示例#4
0
 private void CommentSelector(UIFeedButton button)
 {
     //ScrollToBottom(true);
     commentArea.CommentText.BecomeFirstResponder();
 }